pub struct FixedVecSlice<V> { /* private fields */ }Expand description
A zero-copy view into a contiguous portion of a FixedVec.
A slice is a view that allows for operations on a sub-region of a FixedVec
without copying the underlying data. It can be created from both immutable
and mutable vectors.
This struct is generic over V, the type of reference to the parent vector,
which can be &FixedVec (for an immutable slice) or &mut FixedVec (for a
mutable slice).
Implementations§
Source§impl<T, W, E, B, V> FixedVecSlice<V>
impl<T, W, E, B, V> FixedVecSlice<V>
Sourcepub fn get(&self, index: usize) -> Option<T>
pub fn get(&self, index: usize) -> Option<T>
Returns the element at index relative to the start of the slice.
Returns None if index is out of bounds of the slice.
Sourcepub unsafe fn get_unchecked(&self, index: usize) -> T
pub unsafe fn get_unchecked(&self, index: usize) -> T
Returns the element at index without bounds checking.
The index is relative to the start of the slice.
§Safety
Calling this method with an out-of-bounds index is undefined behavior.
Sourcepub fn iter(&self) -> FixedVecSliceIter<'_, T, W, E, B, V> ⓘ
pub fn iter(&self) -> FixedVecSliceIter<'_, T, W, E, B, V> ⓘ
Returns an iterator over the elements in the slice.
Sourcepub fn binary_search(&self, value: &T) -> Result<usize, usize>where
T: Ord,
pub fn binary_search(&self, value: &T) -> Result<usize, usize>where
T: Ord,
Binary searches this slice for a given element.
If the value is found, returns Ok(usize) with the index of the
matching element within the slice. If the value is not found, returns
Err(usize) with the index where the value could be inserted to
maintain order.
Source§impl<T, W, E, B, V> FixedVecSlice<V>
impl<T, W, E, B, V> FixedVecSlice<V>
Trait Implementations§
Source§impl<V: Debug> Debug for FixedVecSlice<V>
impl<V: Debug> Debug for FixedVecSlice<V>
Source§impl<T, W, E, B, T2, V> PartialEq<&[T2]> for FixedVecSlice<V>
impl<T, W, E, B, T2, V> PartialEq<&[T2]> for FixedVecSlice<V>
Source§impl<T, W, E, B, B2, V> PartialEq<&FixedVec<T, W, E, B2>> for FixedVecSlice<V>
impl<T, W, E, B, B2, V> PartialEq<&FixedVec<T, W, E, B2>> for FixedVecSlice<V>
Source§impl<T, W, E, B, B2, V> PartialEq<FixedVec<T, W, E, B2>> for FixedVecSlice<V>
impl<T, W, E, B, B2, V> PartialEq<FixedVec<T, W, E, B2>> for FixedVecSlice<V>
Source§impl<T, W, E, B, B2, V> PartialEq<FixedVecSlice<V>> for FixedVec<T, W, E, B>
impl<T, W, E, B, B2, V> PartialEq<FixedVecSlice<V>> for FixedVec<T, W, E, B>
Source§impl<T, W, E, B, V1, V2> PartialEq<FixedVecSlice<V2>> for FixedVecSlice<V1>
impl<T, W, E, B, V1, V2> PartialEq<FixedVecSlice<V2>> for FixedVecSlice<V1>
impl<T, W, E, B, V> Eq for FixedVecSlice<V>
Auto Trait Implementations§
impl<V> Freeze for FixedVecSlice<V>where
V: Freeze,
impl<V> RefUnwindSafe for FixedVecSlice<V>where
V: RefUnwindSafe,
impl<V> Send for FixedVecSlice<V>where
V: Send,
impl<V> Sync for FixedVecSlice<V>where
V: Sync,
impl<V> Unpin for FixedVecSlice<V>where
V: Unpin,
impl<V> UnwindSafe for FixedVecSlice<V>where
V: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more