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.