Trait kernel::processbuffer::ProcessSliceIndex

source ·
pub trait ProcessSliceIndex<PB: ?Sized>: Sealed {
    type Output: ?Sized;

    // Required methods
    fn get(self, slice: &PB) -> Option<&Self::Output>;
    fn index(self, slice: &PB) -> &Self::Output;
}
Expand description

Equivalent of the Rust core library’s SliceIndex type for process slices. This helper trait is used to abstract over indexing operators into process slices, and is used to “overload” the .get() methods such that it can be called with multiple different indexing operators.

While we can use the core library’s SliceIndex trait, parameterized over our own ProcessSlice types, this trait includes mandatory methods that are undesirable for the process buffer infrastructure, such as unchecked or mutable index operations. Furthermore, implementing it requires the slice_index_methods nightly feature. Thus we vendor our own, small variant of this trait.

Required Associated Types§

Required Methods§

source

fn get(self, slice: &PB) -> Option<&Self::Output>

source

fn index(self, slice: &PB) -> &Self::Output

Implementations on Foreign Types§

source§

impl ProcessSliceIndex<ReadableProcessSlice> for usize

source§

impl ProcessSliceIndex<ReadableProcessSlice> for Range<usize>

source§

impl ProcessSliceIndex<ReadableProcessSlice> for RangeFrom<usize>

source§

impl ProcessSliceIndex<ReadableProcessSlice> for RangeTo<usize>

source§

impl ProcessSliceIndex<WriteableProcessSlice> for usize

§

type Output = Cell<u8>

source§

fn get(self, slice: &WriteableProcessSlice) -> Option<&Self::Output>

source§

fn index(self, slice: &WriteableProcessSlice) -> &Self::Output

source§

impl ProcessSliceIndex<WriteableProcessSlice> for Range<usize>

source§

impl ProcessSliceIndex<WriteableProcessSlice> for RangeFrom<usize>

source§

impl ProcessSliceIndex<WriteableProcessSlice> for RangeTo<usize>

Implementors§