pub trait CustomSerializer<T> {
// Provided methods
fn to_json_string(&self) -> String
where Self: Serialize + Sized { ... }
fn from_json_string(data_string: String) -> T
where T: for<'a> Deserialize<'a> { ... }
}
Expand description
A trait for custom serialization and deserialization.
Provides methods to convert the implementing type to and from JSON strings.
Provided Methods§
Sourcefn to_json_string(&self) -> String
fn to_json_string(&self) -> String
Sourcefn from_json_string(data_string: String) -> Twhere
T: for<'a> Deserialize<'a>,
fn from_json_string(data_string: String) -> Twhere
T: for<'a> Deserialize<'a>,
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.