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§
sourcefn offset_from(&self, start: &Start) -> usize
fn offset_from(&self, start: &Start) -> usize
Offset between the first byte of start
and the first byte of self
a
Note: This is an offset, not an index, and may point to the end of input
(start.len()
) when self
is exhausted.
Implementations on Foreign Types§
source§impl<'a> Offset<<&'a str as Stream>::Checkpoint> for &'a str
impl<'a> Offset<<&'a str as Stream>::Checkpoint> for &'a str
fn offset_from(&self, other: &<&'a str as Stream>::Checkpoint) -> usize
source§impl<'a, T> Offset<<&'a [T] as Stream>::Checkpoint> for &'a [T]
impl<'a, T> Offset<<&'a [T] as Stream>::Checkpoint> for &'a [T]
fn offset_from(&self, other: &<&'a [T] as Stream>::Checkpoint) -> usize
source§impl<I> Offset for (I, usize)where
I: Offset,
impl<I> Offset for (I, usize)where
I: Offset,
fn offset_from(&self, start: &Self) -> usize
source§impl<I> Offset<<(I, usize) as Stream>::Checkpoint> for (I, usize)
impl<I> Offset<<(I, usize) as Stream>::Checkpoint> for (I, usize)
fn offset_from(&self, other: &<(I, usize) as Stream>::Checkpoint) -> usize
Implementors§
impl<'a> Offset for &'a BStr
impl<'a> Offset for &'a Bytes
impl<'a> Offset<<&'a BStr as Stream>::Checkpoint> for &'a BStr
impl<'a> Offset<<&'a Bytes as Stream>::Checkpoint> for &'a Bytes
impl<I> Offset for Located<I>where
I: Stream,
impl<I> Offset for Partial<I>where
I: Stream,
impl<I> Offset<<Located<I> as Stream>::Checkpoint> for Located<I>where
I: Stream,
impl<I> Offset<<Partial<I> as Stream>::Checkpoint> for Partial<I>where
I: Stream,
impl<I, E> Offset for Recoverable<I, E>
Available on crate features
unstable-recover
and std
only.impl<I, E> Offset<<Recoverable<I, E> as Stream>::Checkpoint> for Recoverable<I, E>
Available on crate features
unstable-recover
and std
only.