Trait JSON

Source
pub trait JSON: Serialize + for<'de> Deserialize<'de> {
    // Provided methods
    fn to_json(&self) -> Result<String> { ... }
    fn from_json(json: &str) -> Result<Self> { ... }
}
Expand description

Handles the to and from JSON conversion.

Provided Methods§

Source

fn to_json(&self) -> Result<String>

Return a JSON string representing the object.

Source

fn from_json(json: &str) -> Result<Self>

Create an object from a JSON string representation.

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§