serde v1.0.97 Release Notes

Release Date: 2019-07-17 // over 4 years ago

    Introduce serde(try_from = "...") attribute to derive Deserialize based on a given implementation of std::convert::TryFrom (#1526, thanks @fanzeyi)

    #[derive(Deserialize)] #[serde(try\_from = "u32")]enum N { Zero, One, Two, }impl TryFrom\<u32\> for N { type Error = String; fn try\_from(u: u32) -\> Result\<Self, Self::Error\> { match u { 0 =\> Ok(Self::Zero), 1 =\> Ok(Self::One), 2 =\> Ok(Self::Two), other =\> Err(format!("out of range: {}", other)), } } }