pub trait Serializable: Serialize + for<'de> Deserialize<'de> {
// Provided methods
fn to_json(&self) -> Result<String> { ... }
fn to_json_pretty(&self) -> Result<String> { ... }
fn from_json(json: &str) -> Result<Self>
where Self: Sized { ... }
}Expand description
Serializable trait for objects that can be serialized
Provided Methods§
Sourcefn to_json_pretty(&self) -> Result<String>
fn to_json_pretty(&self) -> Result<String>
Serialize to JSON pretty string
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.
Implementors§
impl<T> Serializable for Twhere
T: Serialize + for<'de> Deserialize<'de>,
Extend Serializable for serializable types