-
-
Notifications
You must be signed in to change notification settings - Fork 841
Open
Labels
Description
Hello - I've got some structs like:
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
pub struct SubscriptionUpdate {
pub result: SubscriptionResult,
pub subscription: u64,
}
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
#[serde(untagged)]
pub enum SubscriptionResult {
#[serde(rename = "ready")]
Ready,
#[serde(rename = "invalid")]
Invalid,
Whatever {
something: String,
},
}
I would expect
let t = SubscriptionUpdate {
subscription: 0,
result: SubscriptionResult::Invalid,
};
To serialize as
{ "result": "invalid", "subscription": 0}
but it's
{ "result": "null", "subscription": 0}
That strikes me as really surprising, and I haven't yet figured how to get it to behave the way I'd like. Any advice? Does this qualify as a bug?
Love serde, btw, great work!
ConnorGray, frol, kjeremy, fletching, miraclx and 8 more