Byteable

Trait Byteable 

Source
pub trait Byteable {
    const SIZE: usize;

    // Required methods
    fn from_bytes(bytes: &[u8]) -> Self;
    fn to_bytes(&self) -> Vec<u8> ;

    // Provided method
    fn try_from_bytes(bytes: &[u8]) -> Result<Self, Error>
       where Self: Sized { ... }
}

Required Associated Constants§

Required Methods§

Source

fn from_bytes(bytes: &[u8]) -> Self

Source

fn to_bytes(&self) -> Vec<u8>

Provided Methods§

Source

fn try_from_bytes(bytes: &[u8]) -> Result<Self, Error>
where Self: Sized,

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§