identity_iota::core

Trait FromJson

Source
pub trait FromJson: Sized + for<'de> Deserialize<'de> {
    // Provided methods
    fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error> { ... }
    fn from_json_slice(
        json: &(impl AsRef<[u8]> + ?Sized),
    ) -> Result<Self, Error> { ... }
    fn from_json_value(json: Value) -> Result<Self, Error> { ... }
}
Expand description

A convenience-trait for types that can be deserialized from JSON.

Provided Methods§

Source

fn from_json(json: &(impl AsRef<str> + ?Sized)) -> Result<Self, Error>

Deserialize Self from a string of JSON text.

Source

fn from_json_slice(json: &(impl AsRef<[u8]> + ?Sized)) -> Result<Self, Error>

Deserialize Self from bytes of JSON text.

Source

fn from_json_value(json: Value) -> Result<Self, Error>

Deserialize Self from a serde_json::Value.

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§

Source§

impl<T> FromJson for T
where T: for<'de> Deserialize<'de>,