Function deserialize

Source
pub fn deserialize<'a, T>(
    subject: &'a [u8],
    format: &SerializationFormat,
) -> Result<T, SerializationError>
where T: Deserialize<'a>,
Expand description

Attempts to deserialise subject using format into T.

§Arguments

  • subject: The Vec<u8> that represents T in binary format.
  • format: The format to use when deserialising subject.

returns: Result<T>

§Errors

This method returns a SerializationError if any of the steps for deserialization fails. See SerializationError for specific details on each error scenario.

§Examples



let json = b"{ \"bar\": \"baz\" }";
deserialize::<Foo>(json, &SerializationFormat::JSON)?;