pub trait FromBytes {
    type Error;
    fn from_bytes(_: &[u8]) -> Result<&Self, Self::Error>;
}
Expand description

A cheap conversion from a byte slice to typed data.

Given a reference to a byte slice, returns a different view of the same data. No allocation is performed, however the underlying data might be checked for correctness (for example when converting to str).

See also the ToBytes trait.

Associated Types

The error type that will be returned if the conversion fails.

Required methods

Tries to convert the provided byte slice into a different type.

Implementations on Foreign Types

Implementors