kernel::processbuffer

Trait 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

Source§

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§