pub trait JsonSerializationType<'de> {
type T: From<Self> + Into<Self> + Serialize + Deserialize<'de>;
fn try_from_json(s: &'de str) -> Result<Self, Error> { ... }
fn try_into_json(self) -> Result<String, Error> { ... }
}
Expand description
Re-export serialization type annotations This trait annotates a given type its corresponding json serialization type, and provide utility functions to easily convert between them
Required Associated Types
type T: From<Self> + Into<Self> + Serialize + Deserialize<'de>
type T: From<Self> + Into<Self> + Serialize + Deserialize<'de>
The corresponding serialization type for json format Self type can be used here to indicate no special convertion is needed TODO: Add default value when the feature lands on stable rust
Provided Methods
fn try_from_json(s: &'de str) -> Result<Self, Error>
fn try_from_json(s: &'de str) -> Result<Self, Error>
Construct from json string
fn try_into_json(self) -> Result<String, Error>
fn try_into_json(self) -> Result<String, Error>
Convert into json string