pub trait FromJson: for<'de> Deserialize<'de> + Sized {
    // 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.

Object Safety§

This trait is not object safe.

Implementors§

source§

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