ToBeBytes

Trait ToBeBytes 

Source
pub trait ToBeBytes {
    type ByteArray: AsRef<[u8]>;

    // Required methods
    fn written_len(&self) -> usize;
    fn to_be_bytes(&self) -> Self::ByteArray;
}
Expand description

Helper traits for types which can be converted to a byte array.

Required Associated Types§

Source

type ByteArray: AsRef<[u8]>

Concrete byte array type.

Required Methods§

Source

fn written_len(&self) -> usize

Length when written to big endian bytes.

Source

fn to_be_bytes(&self) -> Self::ByteArray

Convert to big endian byte array.

Implementations on Foreign Types§

Source§

impl ToBeBytes for u8

Source§

impl ToBeBytes for u16

Source§

impl ToBeBytes for u32

Source§

impl ToBeBytes for u64

Source§

impl ToBeBytes for ()

Implementors§