[][src]Trait sp_runtime::DeserializeOwned

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

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.

This code runs with edition 2018
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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

Loading content...