Struct Filter
#[must_use = "iterators are lazy and do nothing unless consumed"]
pub struct Filter<I, P> { pub(crate) iter: I, pub(in ::iter::adapters::filter) predicate: P }
An iterator that filters the elements of iter with predicate.
This struct is created by the filter method on Iterator. See its
documentation for more.
Fields
iter: Ipredicate: P
Implementations
impl<I, P> Filter<I, P>
const fn new(iter: I, predicate: P) -> Filter<I, P>
impl<I, P> Filter<I, P>
where
I: Iterator,
P: FnMut(&I::Item) -> bool,
fn next_chunk_dropless<const N: usize>(&mut self) -> Result<[I::Item; N], IntoIter<I::Item, N>>
Trait Implementations
impl<I: Clone, P: Clone> Clone for Filter<I, P>
fn clone(&self) -> Filter<I, P>
impl<I: Debug, P> Debug for Filter<I, P>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<I: DoubleEndedIterator, P> DoubleEndedIterator for Filter<I, P>
where
P: FnMut(&I::Item) -> bool,
fn next_back(&mut self) -> Option<I::Item>fn try_rfold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R where Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Output = Acc>,fn rfold<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc where Fold: FnMut(Acc, Self::Item) -> Acc,
impl<I: FusedIterator, P> FusedIterator for Filter<I, P>
where
P: FnMut(&I::Item) -> bool,
impl<I: InPlaceIterable, P> InPlaceIterable for Filter<I, P>
const EXPAND_BY: Option<NonZero<usize>> = I::EXPAND_BY;const MERGE_BY: Option<NonZero<usize>> = I::MERGE_BY;
impl<I: Iterator, P> Iterator for Filter<I, P>
where
P: FnMut(&I::Item) -> bool,
type Item = <I as Iterator>::Item;fn next(&mut self) -> Option<I::Item>fn next_chunk<const N: usize>(&mut self) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>fn size_hint(&self) -> (usize, Option<usize>)fn count(self) -> usizefn try_fold<Acc, Fold, R>(&mut self, init: Acc, fold: Fold) -> R where Self: Sized, Fold: FnMut(Acc, Self::Item) -> R, R: Try<Output = Acc>,fn fold<Acc, Fold>(self, init: Acc, fold: Fold) -> Acc where Fold: FnMut(Acc, Self::Item) -> Acc,
impl<I: OneShot, P> OneShot for Filter<I, P>
impl<I: TrustedFused, F> TrustedFused for Filter<I, F>
impl<P, I> SourceIter for Filter<I, P>
where
I: SourceIter,
type Source = <I as SourceIter>::Source;unsafe fn as_inner(&mut self) -> &mut I::Source
Auto Trait Implementations
impl<I, P> Freeze for Filter<I, P>
where
I: Freeze,
P: Freeze,
impl<I, P> RefUnwindSafe for Filter<I, P>
where
I: RefUnwindSafe,
P: RefUnwindSafe,
impl<I, P> Send for Filter<I, P>
where
I: Send,
P: Send,
impl<I, P> Sync for Filter<I, P>
where
I: Sync,
P: Sync,
impl<I, P> Unpin for Filter<I, P>
where
I: Unpin,
P: Unpin,
impl<I, P> UnsafeUnpin for Filter<I, P>
where
I: UnsafeUnpin,
P: UnsafeUnpin,
impl<I, P> UnwindSafe for Filter<I, P>
where
I: UnwindSafe,
P: UnwindSafe,
Blanket Implementations
impl<I> IntoIterator for Filter<I, P>
where
I: Iterator,
type Item = <I as Iterator>::Item;type IntoIter = I;fn into_iter(self) -> I
impl<T> Any for Filter<I, P>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Filter<I, P>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Filter<I, P>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Filter<I, P>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Filter<I, P>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> SizeHint for Filter<I, P>
where
T: ?Sized,
fn lower_bound(&self) -> usizefn upper_bound(&self) -> Option<usize>
impl<T> SizedTypeProperties for Filter<I, P>
impl<T, U> Into<U> for Filter<I, P>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Filter<I, P>
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Filter<I, P>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>