Trait in_situ::Raw
[−]
[src]
pub trait Raw: AsRef<[u8]> + Default + PartialEq + Eq + PartialOrd + Ord + Debug + Hash { fn split_off(&mut self, at: usize) -> Self; fn split_to(&mut self, at: usize) -> Self; }
Abstracts immutable as well as mutable generic bytes view types like [u8]
,
mut [u8]
, Bytes
, or BytesMut
as immutable views and requires some
standard nice-to-have but easily-to-get traits, so the wrapper can just
derive them. Requires methods to be implemented to split views into
subviews.
Required Methods
fn split_off(&mut self, at: usize) -> Self
Splits the bytes into two at the given index.
Afterwards self
contains elements [0, at)
, and the returned Self
contains elements [at, len)
.
fn split_to(&mut self, at: usize) -> Self
Splits the bytes into two at the given index.
Afterwards self
contains elements [at, len)
, and the returned Self
contains elements [0, at)
.