pub struct AppendSlice<'a, T>(/* private fields */);Expand description
A slice-like view produced by AppendVec::slice.
Internally the vector is backed by multiple exponentially growing buckets.
An AppendSlice therefore stores a small SmallVec of slice
references so that the common case of spanning at most four buckets is
allocated on the stack.
The structure is copy-free and merely borrows the data. Two different iterator flavours are provided:
iter– borrows&selfand yields&Titems.IntoIterator– consumes the range and yields&Titems with the exact-size, fused iteratorAppendSliceIntoIter.
Implementations§
Source§impl<'a, T> AppendSlice<'a, T>
impl<'a, T> AppendSlice<'a, T>
Sourcepub fn new(slices: &'a [&'a [T]]) -> Self
pub fn new(slices: &'a [&'a [T]]) -> Self
A view over slices presented as one contiguous sequence.
Sourcepub fn get(&self, index: usize) -> Option<&'a T>
pub fn get(&self, index: usize) -> Option<&'a T>
Returns a reference to the element at index, or None if the index is
out of bounds for this range.
Equivalent to self.into_iter().nth(index) but constant-time.
Sourcepub fn iter(&self) -> Iter<'_, T>
pub fn iter(&self) -> Iter<'_, T>
Returns an iterator over the elements in the range.
This is the same iterator that the &AppendSlice implementation of
IntoIterator returns.
Trait Implementations§
Source§impl<'a, T: Debug> Debug for AppendSlice<'a, T>
impl<'a, T: Debug> Debug for AppendSlice<'a, T>
Source§impl<T> Default for AppendSlice<'_, T>
impl<T> Default for AppendSlice<'_, T>
Source§impl<'a, T> FromIterator<&'a [T]> for AppendSlice<'a, T>
impl<'a, T> FromIterator<&'a [T]> for AppendSlice<'a, T>
Source§impl<T> Index<usize> for AppendSlice<'_, T>
impl<T> Index<usize> for AppendSlice<'_, T>
Source§impl<'a, T> IntoIterator for AppendSlice<'a, T>
impl<'a, T> IntoIterator for AppendSlice<'a, T>
Source§impl<'a, 'b, T> IntoIterator for &'b AppendSlice<'a, T>where
'b: 'a,
impl<'a, 'b, T> IntoIterator for &'b AppendSlice<'a, T>where
'b: 'a,
Auto Trait Implementations§
impl<'a, T> Freeze for AppendSlice<'a, T>
impl<'a, T> RefUnwindSafe for AppendSlice<'a, T>where
T: RefUnwindSafe,
impl<'a, T> Send for AppendSlice<'a, T>where
T: Sync,
impl<'a, T> Sync for AppendSlice<'a, T>where
T: Sync,
impl<'a, T> Unpin for AppendSlice<'a, T>
impl<'a, T> UnsafeUnpin for AppendSlice<'a, T>
impl<'a, T> UnwindSafe for AppendSlice<'a, T>where
T: RefUnwindSafe,
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
Mutably borrows from an owned value. Read more
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> ⓘ
Converts
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> ⓘ
Converts
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