Skip to main content

FromBytes

Trait FromBytes 

Source
pub(crate) trait FromBytes: Sized {
    // Required method
    fn from_bytes(b: &[u8], p: Pos) -> Result<Self>;

    // Provided method
    fn from_vec(v: Vec<u8>, p: Pos) -> Result<Self> { ... }
}
Expand description

Describes a value that van be decoded from a bunch of bytes.

Used for decoding the objects between BEGIN and END tags.

Required Methods§

Source

fn from_bytes(b: &[u8], p: Pos) -> Result<Self>

Try to parse a value of this type from a byte slice

Provided Methods§

Source

fn from_vec(v: Vec<u8>, p: Pos) -> Result<Self>

Try to parse a value of this type from a vector of bytes, and consume that value

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§