Trait regex_automata::util::wire::Endian

source ·
pub(crate) trait Endian {
    // Required methods
    fn write_u16(n: u16, dst: &mut [u8]);
    fn write_u32(n: u32, dst: &mut [u8]);
    fn write_u128(n: u128, dst: &mut [u8]);
}
Expand description

A simple trait for writing code generic over endianness.

This is similar to what byteorder provides, but we only need a very small subset.

Required Methods§

source

fn write_u16(n: u16, dst: &mut [u8])

Writes a u16 to the given destination buffer in a particular endianness. If the destination buffer has a length smaller than 2, then this panics.

source

fn write_u32(n: u32, dst: &mut [u8])

Writes a u32 to the given destination buffer in a particular endianness. If the destination buffer has a length smaller than 4, then this panics.

source

fn write_u128(n: u128, dst: &mut [u8])

Writes a u128 to the given destination buffer in a particular endianness. If the destination buffer has a length smaller than 16, then this panics.

Object Safety§

This trait is not object safe.

Implementors§