Trait ByteSlice

Source
pub(crate) trait ByteSlice {
    // Required methods
    fn read_u64(&self) -> u64;
    fn write_u64(&mut self, value: u64);
    fn offset_from(&self, other: &Self) -> isize;
    fn parse_digits(&self, func: impl FnMut(u8)) -> &Self;
}
🔬This is a nightly-only experimental API. (dec2flt)
Expand description

Helper methods to process immutable bytes.

Required Methods§

Source

fn read_u64(&self) -> u64

🔬This is a nightly-only experimental API. (dec2flt)

Reads 8 bytes as a 64-bit integer in little-endian order.

Source

fn write_u64(&mut self, value: u64)

🔬This is a nightly-only experimental API. (dec2flt)

Writes a 64-bit integer as 8 bytes in little-endian order.

Source

fn offset_from(&self, other: &Self) -> isize

🔬This is a nightly-only experimental API. (dec2flt)

Calculate the difference in length between two slices.

Source

fn parse_digits(&self, func: impl FnMut(u8)) -> &Self

🔬This is a nightly-only experimental API. (dec2flt)

Iteratively parse and consume digits from bytes.

Returns the same bytes with consumed digits being elided. Breaks on invalid digits.

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§