Trait sp_runtime::DeserializeOwned[][src]

pub trait DeserializeOwned: for<'de> Deserialize<'de> { }
Expand description

A data structure that can be deserialized without borrowing any data from the deserializer.

This is primarily useful for trait bounds on functions. For example a from_str function may be able to deserialize a data structure that borrows from the input string, but a from_reader function may only deserialize owned data.

fn from_str<'a, T>(s: &'a str) -> Result<T>
where
    T: Deserialize<'a>;

fn from_reader<R, T>(rdr: R) -> Result<T>
where
    R: Read,
    T: DeserializeOwned;

Lifetime

The relationship between Deserialize and DeserializeOwned in trait bounds is explained in more detail on the page Understanding deserializer lifetimes.

Implementors