pub trait JsonSerializationType<'de>: Sized {
    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

This trait annotates a given type its corresponding json serialization type, and provide utility functions to easily convert between them

Required Associated Types

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

Construct from json string

Convert into json string

Implementors