syscall::dirent

Trait Buffer

source
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§

source

fn empty() -> Self

source

fn length(&self) -> usize

source

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.

source

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.

source

fn zero_out(self) -> Result<()>

Write zeroes to this part of the buffer.

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.

Implementations on Foreign Types§

source§

impl<'a> Buffer<'a> for &'a mut [u8]

source§

fn empty() -> Self

source§

fn length(&self) -> usize

source§

fn split_at(self, index: usize) -> Option<[Self; 2]>

source§

fn copy_from_slice_exact(self, src: &[u8]) -> Result<()>

source§

fn zero_out(self) -> Result<()>

Implementors§