TryFromBytes

Trait TryFromBytes 

Source
pub trait TryFromBytes<A: AsRef<[u8]>>: Sized {
    type Error;

    // Required method
    fn try_from_bytes(bytes: A) -> Result<Self, Self::Error>;
}
Expand description

Trait for converting a sequence of bytes into some data structure

Required Associated Types§

Source

type Error

Error type yielded if conversion fails

Required Methods§

Source

fn try_from_bytes(bytes: A) -> Result<Self, Self::Error>

Try to convert from some sequence of bytes T into Self

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<Bytes: AsRef<[u8]>, PayloadBytes: Array<Item = u8> + AppendCopy<u8>, Options: OptionMap> TryFromBytes<Bytes> for Message<PayloadBytes, Options>