pub struct Items<T>(/* private fields */);Expand description
An eager Sequence wrapper around an iterator’s collected items.
A lazy iterator cannot implement Sequence directly: the trait borrows
its items through &self, and a blanket impl<I: Iterator> would collide
with the concrete collection impls under coherence. Items sidesteps both
problems by collecting the iterator into a Vec<T> up front, which means
the assertion sees a full, indexable view of the produced values.
Construct one with items. The wrapper is just a Vec<T> underneath, so
it carries no surprises around iteration order or repeated reads.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Items<T>
impl<T> RefUnwindSafe for Items<T>where
T: RefUnwindSafe,
impl<T> Send for Items<T>where
T: Send,
impl<T> Sync for Items<T>where
T: Sync,
impl<T> Unpin for Items<T>where
T: Unpin,
impl<T> UnsafeUnpin for Items<T>
impl<T> UnwindSafe for Items<T>where
T: 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
Mutably borrows from an owned value. Read more