pub struct UnordItems<T, I: Iterator<Item = T>>(I);
Expand description
UnordItems
is the order-less version of Iterator
. It only contains methods
that don’t (easily) expose an ordering of the underlying items.
Most methods take an Fn
where the Iterator
-version takes an FnMut
. This
is to reduce the risk of accidentally leaking the internal order via the closure
environment. Otherwise one could easily do something like
ⓘ
let mut ordered = vec![];
unordered_items.all(|x| ordered.push(x));
It’s still possible to do the same thing with an Fn
by using interior mutability,
but the chance of doing it accidentally is reduced.
Tuple Fields§
§0: I
Implementations§
Source§impl<T, I: Iterator<Item = T>> UnordItems<T, I>
impl<T, I: Iterator<Item = T>> UnordItems<T, I>
pub fn map<U, F: Fn(T) -> U>( self, f: F, ) -> UnordItems<U, impl Iterator<Item = U>>
pub fn all<F: Fn(T) -> bool>(self, f: F) -> bool
pub fn any<F: Fn(T) -> bool>(self, f: F) -> bool
pub fn filter<F: Fn(&T) -> bool>( self, f: F, ) -> UnordItems<T, impl Iterator<Item = T>>
pub fn filter_map<U, F: Fn(T) -> Option<U>>( self, f: F, ) -> UnordItems<U, impl Iterator<Item = U>>
pub fn max(self) -> Option<T>where
T: Ord,
pub fn min(self) -> Option<T>where
T: Ord,
pub fn sum<S>(self) -> Swhere
S: Sum<T>,
pub fn product<S>(self) -> Swhere
S: Product<T>,
pub fn count(self) -> usize
pub fn flat_map<U, F, O>(self, f: F) -> UnordItems<O, impl Iterator<Item = O>>where
U: IntoIterator<Item = O>,
F: Fn(T) -> U,
pub fn collect<C: From<UnordItems<T, I>>>(self) -> C
Source§impl<'a, T: Clone + 'a, I: Iterator<Item = &'a T>> UnordItems<&'a T, I>
impl<'a, T: Clone + 'a, I: Iterator<Item = &'a T>> UnordItems<&'a T, I>
pub fn cloned(self) -> UnordItems<T, impl Iterator<Item = T>>
Source§impl<'a, T: Copy + 'a, I: Iterator<Item = &'a T>> UnordItems<&'a T, I>
impl<'a, T: Copy + 'a, I: Iterator<Item = &'a T>> UnordItems<&'a T, I>
pub fn copied(self) -> UnordItems<T, impl Iterator<Item = T>>
Source§impl<T, I: Iterator<Item = T>> UnordItems<T, I>
impl<T, I: Iterator<Item = T>> UnordItems<T, I>
pub fn into_sorted<HCX>(self, hcx: &HCX) -> Vec<T>where
T: ToStableHashKey<HCX>,
pub fn into_sorted_stable_ord(self) -> Vec<T>where
T: StableCompare,
pub fn into_sorted_stable_ord_by_key<K, C>(self, project_to_key: C) -> Vec<T>
pub fn collect_sorted<HCX, C>(self, hcx: &HCX, cache_sort_key: bool) -> C
pub fn collect_stable_ord_by_key<K, C, P>(self, project_to_key: P) -> C
Trait Implementations§
Source§impl<T: Clone, I: Clone + Iterator<Item = T>> Clone for UnordItems<T, I>
impl<T: Clone, I: Clone + Iterator<Item = T>> Clone for UnordItems<T, I>
Source§fn clone(&self) -> UnordItems<T, I>
fn clone(&self) -> UnordItems<T, I>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<K: Hash + Eq, V, I: Iterator<Item = (K, V)>> From<UnordItems<(K, V), I>> for UnordMap<K, V>
impl<K: Hash + Eq, V, I: Iterator<Item = (K, V)>> From<UnordItems<(K, V), I>> for UnordMap<K, V>
Source§fn from(items: UnordItems<(K, V), I>) -> Self
fn from(items: UnordItems<(K, V), I>) -> Self
Converts to this type from the input type.
Source§impl<T, I: Iterator<Item = T>> From<UnordItems<T, I>> for UnordBag<T>
impl<T, I: Iterator<Item = T>> From<UnordItems<T, I>> for UnordBag<T>
Source§fn from(value: UnordItems<T, I>) -> Self
fn from(value: UnordItems<T, I>) -> Self
Converts to this type from the input type.
Source§impl<V: Hash + Eq, I: Iterator<Item = V>> From<UnordItems<V, I>> for UnordSet<V>
impl<V: Hash + Eq, I: Iterator<Item = V>> From<UnordItems<V, I>> for UnordSet<V>
Source§fn from(value: UnordItems<V, I>) -> Self
fn from(value: UnordItems<V, I>) -> Self
Converts to this type from the input type.
impl<T, I> !IntoIterator for UnordItems<T, I>
Auto Trait Implementations§
impl<T, I> DynSend for UnordItems<T, I>where
I: DynSend,
impl<T, I> DynSync for UnordItems<T, I>where
I: DynSync,
impl<T, I> Freeze for UnordItems<T, I>where
I: Freeze,
impl<T, I> RefUnwindSafe for UnordItems<T, I>where
I: RefUnwindSafe,
impl<T, I> Send for UnordItems<T, I>where
I: Send,
impl<T, I> Sync for UnordItems<T, I>where
I: Sync,
impl<T, I> Unpin for UnordItems<T, I>where
I: Unpin,
impl<T, I> UnwindSafe for UnordItems<T, I>where
I: 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
Source§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
Source§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<'a, T> Captures<'a> for Twhere
T: ?Sized,
Layout§
Note: Unable to compute type layout, possibly due to this type having generic parameters. Layout can only be computed for concrete, fully-instantiated types.