pub trait Buffer<'a>: Sized + 'a {
// Required methods
fn empty() -> Self;
fn length(&self) -> usize;
fn split_at(self, index: usize) -> Option<[Self; 2]>;
fn copy_from_slice_exact(self, src: &[u8]) -> Result<()>;
fn zero_out(self) -> Result<()>;
}
Expand description
Abstraction between &mut u8 and the kernel’s UserSliceWo.
Required Methods§
fn empty() -> Self
fn length(&self) -> usize
sourcefn split_at(self, index: usize) -> Option<[Self; 2]>
fn split_at(self, index: usize) -> Option<[Self; 2]>
Split all of self
into two disjoint contiguous subbuffers of lengths index
and `length
- index` respectively.
Returns None if and only if index > length
.
sourcefn copy_from_slice_exact(self, src: &[u8]) -> Result<()>
fn copy_from_slice_exact(self, src: &[u8]) -> Result<()>
Copy from src
, lengths must match exactly.
Allowed to overwrite subsequent buffer space, for performance reasons. Can be changed in the future if too restrictive.
Object Safety§
This trait is not object safe.