Skip to main content

Offset

Trait Offset 

Source
pub trait Offset<Start = Self> {
    // Required method
    fn offset_from(&self, start: &Start) -> usize;
}
Expand description

Useful functions to calculate the offset between slices and show a hexdump of a slice

Required Methods§

Source

fn offset_from(&self, start: &Start) -> usize

Offset between the first byte of start and the first byte of selfa

Note: This is an offset, not an index, and may point to the end of input (start.len()) when self is exhausted.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Offset for &str

Source§

fn offset_from(&self, start: &Self) -> usize

Source§

impl<'a, T> Offset<<&'a [T] as Stream>::Checkpoint> for &'a [T]
where T: Clone + Debug,

Source§

fn offset_from(&self, other: &<&'a [T] as Stream>::Checkpoint) -> usize

Source§

impl<'a> Offset<<&'a str as Stream>::Checkpoint> for &'a str

Source§

fn offset_from(&self, other: &<&'a str as Stream>::Checkpoint) -> usize

Source§

impl<T> Offset for &[T]

Source§

fn offset_from(&self, start: &Self) -> usize

Implementors§

Source§

impl Offset for &BStr

Source§

impl Offset for &Bytes

Source§

impl<'a> Offset<<&'a BStr as Stream>::Checkpoint> for &'a BStr

Source§

impl<'a> Offset<<&'a Bytes as Stream>::Checkpoint> for &'a Bytes

Source§

impl<I, S> Offset for Checkpoint<I, S>
where I: Offset,

Source§

impl<I, S> Offset for Stateful<I, S>
where I: Stream, S: Clone + Debug,

Source§

impl<I, S> Offset<<Stateful<I, S> as Stream>::Checkpoint> for Stateful<I, S>
where I: Stream, S: Debug,

Source§

impl<I> Offset for Bits<I>
where I: Offset,

Source§

impl<I> Offset for LocatingSlice<I>
where I: Stream,

Source§

impl<I> Offset for Partial<I>
where I: Stream,

Source§

impl<I> Offset<<Bits<I> as Stream>::Checkpoint> for Bits<I>
where I: Stream<Token = u8> + Clone,

Source§

impl<I> Offset<<LocatingSlice<I> as Stream>::Checkpoint> for LocatingSlice<I>
where I: Stream,

Source§

impl<I> Offset<<Partial<I> as Stream>::Checkpoint> for Partial<I>
where I: Stream,

Source§

impl<T> Offset for TokenSlice<'_, T>
where T: Debug + Clone,

Source§

impl<T> Offset<<TokenSlice<'_, T> as Stream>::Checkpoint> for TokenSlice<'_, T>
where T: Debug + Clone,