Struct Filter

Source
pub struct Filter<Inner: ParallelIterator, F> { /* private fields */ }
Expand description

This struct is created by the filter() method on ParallelIteratorExt.

You most likely won’t need to interact with this struct directly, as it implements the ParallelIterator and ParallelIteratorExt traits, but it is nonetheless public because of the must_use annotation.

Trait Implementations§

Source§

impl<Inner: ParallelIterator, F> ParallelAdaptor for Filter<Inner, F>
where F: Fn(&Inner::Item) -> bool + Sync,

Source§

type Item = <Inner as ParallelIterator>::Item

The type of items that this parallel iterator adaptor produces. Read more
Source§

type Inner = Inner

The underlying parallel iterator that this type adapts on top of.
Source§

fn descriptor( self, ) -> ParallelAdaptorDescriptor<Self::Item, Self::Inner, impl Fn(<Self::Inner as ParallelIterator>::Item) -> Option<Self::Item> + Sync>

Definition of the parallel adaptor.

Auto Trait Implementations§

§

impl<Inner, F> Freeze for Filter<Inner, F>
where Inner: Freeze, F: Freeze,

§

impl<Inner, F> RefUnwindSafe for Filter<Inner, F>
where Inner: RefUnwindSafe, F: RefUnwindSafe,

§

impl<Inner, F> Send for Filter<Inner, F>
where Inner: Send, F: Send,

§

impl<Inner, F> Sync for Filter<Inner, F>
where Inner: Sync, F: Sync,

§

impl<Inner, F> Unpin for Filter<Inner, F>
where Inner: Unpin, F: Unpin,

§

impl<Inner, F> UnwindSafe for Filter<Inner, F>
where Inner: UnwindSafe, F: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ParallelIterator for T
where T: ParallelAdaptor,

Source§

type Item = <T as ParallelAdaptor>::Item

The type of items that this parallel iterator produces. Read more
Source§

fn upper_bounded_pipeline<Output, Accum>( self, init: impl Fn() -> Accum + Sync, process_item: impl Fn(Accum, usize, <T as ParallelIterator>::Item) -> ControlFlow<Accum, Accum> + Sync, finalize: impl Fn(Accum) -> Output + Sync, reduce: impl Fn(Output, Output) -> Output, ) -> Output
where Output: Send,

Runs the pipeline defined by the given functions on this iterator. Read more
Source§

fn iter_pipeline<Output>( self, accum: impl Accumulator<<T as ParallelIterator>::Item, Output> + Sync, reduce: impl Accumulator<Output, Output>, ) -> Output
where Output: Send,

Runs the pipeline defined by the given functions on this iterator. Read more
Source§

fn pipeline<Output: Send, Accum>( self, init: impl Fn() -> Accum + Sync, process_item: impl Fn(Accum, Self::Item) -> Accum + Sync, finalize: impl Fn(Accum) -> Output + Sync, reduce: impl Fn(Output, Output) -> Output, ) -> Output

Runs the pipeline defined by the given functions on this iterator. Read more
Source§

fn short_circuiting_pipeline<Output: Send, Accum, Break>( self, init: impl Fn() -> Accum + Sync, process_item: impl Fn(Accum, Self::Item) -> ControlFlow<Break, Accum> + Sync, finalize: impl Fn(ControlFlow<Break, Accum>) -> Output + Sync, reduce: impl Fn(Output, Output) -> Output, ) -> Output

Runs the pipeline defined by the given functions on this iterator. Read more
Source§

impl<T> ParallelIteratorExt for T

Source§

fn all<F>(self, f: F) -> bool
where F: Fn(Self::Item) -> bool + Sync,

Returns true if all items produced by this iterator satisfy the predicate f, and false otherwise. Read more
Source§

fn any<F>(self, f: F) -> bool
where F: Fn(Self::Item) -> bool + Sync,

Returns true if any item produced by this iterator satisfies the predicate f, and false otherwise. Read more
Source§

fn cloned<'a, T>(self) -> Cloned<Self>
where Self: ParallelIterator<Item = &'a T>, T: Clone + 'a,

Returns a parallel iterator that produces items that are cloned from the items of this iterator. This is useful if you have an iterator over &T and want an iterator over T, when T is Clone. Read more
Source§

fn cmp<T>(self) -> Ordering
where Self: ParallelIterator<Item = (T, T)>, T: Ord,

Compare the pairs of items produced by this iterator using lexicographic order. Read more
Source§

fn cmp_by<T, U, F>(self, f: F) -> Ordering
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T, U) -> Ordering + Sync,

Compare the pairs of items produced by this iterator using lexicographic order with the comparison function f. Read more
Source§

fn cmp_by_key<T, A, F>(self, f: F) -> Ordering
where Self: ParallelIterator<Item = (T, T)>, F: Fn(T) -> A + Sync, A: Ord,

Compare the pairs of items produced by this iterator using lexicographic order, after mapping them with f. Read more
Source§

fn cmp_by_keys<T, U, A, F, G>(self, f: F, g: G) -> Ordering
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T) -> A + Sync, G: Fn(U) -> A + Sync, A: Ord,

Compare the pairs of items produced by this iterator using lexicographic order, after mapping them with f and g. Read more
Source§

fn copied<'a, T>(self) -> Copied<Self>
where Self: ParallelIterator<Item = &'a T>, T: Copy + 'a,

Returns a parallel iterator that produces items that are copied from the items of this iterator. This is useful if you have an iterator over &T and want an iterator over T, when T is Copy. Read more
Source§

fn eq<T, U>(self) -> bool
where Self: ParallelIterator<Item = (T, U)>, T: PartialEq<U>,

Returns true if all pairs of items produced by this iterator are equal, and false otherwise. Read more
Source§

fn eq_by_key<T, A, F>(self, f: F) -> bool
where Self: ParallelIterator<Item = (T, T)>, F: Fn(T) -> A + Sync, A: PartialEq,

Returns true if all pairs of items produced by this iterator yield equal keys when mapped by f, and false otherwise. Read more
Source§

fn eq_by_keys<T, U, A, B, F, G>(self, f: F, g: G) -> bool
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T) -> A + Sync, G: Fn(U) -> B + Sync, A: PartialEq<B>,

Returns true if all pairs of items produced by this iterator yield equal keys when mapped by f and g, and false otherwise. Read more
Source§

fn filter<F>(self, f: F) -> Filter<Self, F>
where F: Fn(&Self::Item) -> bool + Sync,

Returns a parallel iterator that produces only the items for which the predicate f returns true. Read more
Source§

fn filter_map<T, F>(self, f: F) -> FilterMap<Self, F>
where F: Fn(Self::Item) -> Option<T> + Sync,

Applies the function f to each item of this iterator, returning a parallel iterator that produces the mapped items x for which f returns Some(x) and skips the items for which f returns None. Read more
Source§

fn find_any<F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item) -> bool + Sync, Self::Item: Send,

Returns any item that satisfies the predicate f, or None if no item satisfies it. Read more
Source§

fn find_first<F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item) -> bool + Sync, Self::Item: Send,

Returns the first item that satisfies the predicate f, or None if no item satisfies it. Read more
Source§

fn find_map_any<T, F>(self, f: F) -> Option<T>
where F: Fn(Self::Item) -> Option<T> + Sync, T: Send,

Applies the function f to items of this iterator, returning any non-None result. Read more
Source§

fn find_map_first<T, F>(self, f: F) -> Option<T>
where F: Fn(Self::Item) -> Option<T> + Sync, T: Send,

Applies the function f to items of this iterator, returning the first non-None result. Read more
Source§

fn for_each<F>(self, f: F)
where F: Fn(Self::Item) + Sync,

Runs f on each item of this parallel iterator. Read more
Source§

fn for_each_init<T, Init, F>(self, init: Init, f: F)
where Init: Fn() -> T + Sync, F: Fn(&mut T, Self::Item) + Sync,

Runs f on each item of this iterator, together with a per-thread mutable value returned by init. Read more
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where F: Fn(&Self::Item) + Sync,

Runs the function f on each item of this iterator in a pass-through manner, returning a parallel iterator producing the original items. Read more
Source§

fn map<T, F>(self, f: F) -> Map<Self, F>
where F: Fn(Self::Item) -> T + Sync,

Applies the function f to each item of this iterator, returning a parallel iterator producing the mapped items. Read more
Source§

fn map_init<I, Init, T, F>(self, init: Init, f: F) -> MapInit<Self, Init, F>
where Init: Fn() -> I + Sync, F: Fn(&mut I, Self::Item) -> T + Sync,

Applies the function f to each item of this iterator, together with a per-thread mutable value returned by init, and returns a parallel iterator producing the mapped items. Read more
Source§

fn max(self) -> Option<Self::Item>
where Self::Item: Ord + Send,

Returns the maximal item of this iterator, or None if this iterator is empty. Read more
Source§

fn max_by<F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item, &Self::Item) -> Ordering + Sync, Self::Item: Send,

Returns the maximal item of this iterator according to the comparison function f, or None if this iterator is empty. Read more
Source§

fn max_by_key<T, F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item) -> T + Sync, T: Ord + Send, Self::Item: Send,

Returns the maximal item of this iterator according to the keys derived from the mapping function f, or None if this iterator is empty. Read more
Source§

fn min(self) -> Option<Self::Item>
where Self::Item: Ord + Send,

Returns the minimal item of this iterator, or None if this iterator is empty. Read more
Source§

fn min_by<F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item, &Self::Item) -> Ordering + Sync, Self::Item: Send,

Returns the minimal item of this iterator according to the comparison function f, or None if this iterator is empty. Read more
Source§

fn min_by_key<T, F>(self, f: F) -> Option<Self::Item>
where F: Fn(&Self::Item) -> T + Sync, T: Ord + Send, Self::Item: Send,

Returns the minimal item of this iterator according to the keys derived from the mapping function f, or None if this iterator is empty. Read more
Source§

fn ne<T, U>(self) -> bool
where Self: ParallelIterator<Item = (T, U)>, T: PartialEq<U>,

Returns true if any pair of items produced by this iterator consists of unequal items, and false otherwise. Read more
Source§

fn ne_by_key<T, A, F>(self, f: F) -> bool
where Self: ParallelIterator<Item = (T, T)>, F: Fn(T) -> A + Sync, A: PartialEq,

Returns true if any pair of items produced by this iterator yields unequal keys when mapped by f, and false otherwise. Read more
Source§

fn ne_by_keys<T, U, A, B, F, G>(self, f: F, g: G) -> bool
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T) -> A + Sync, G: Fn(U) -> B + Sync, A: PartialEq<B>,

Returns true if any pair of items produced by this iterator yields unequal keys when mapped by f and g, and false otherwise. Read more
Source§

fn partial_cmp<T, U>(self) -> Option<Ordering>
where Self: ParallelIterator<Item = (T, U)>, T: PartialOrd<U>,

Compare the pairs of items produced by this iterator using lexicographic order. Read more
Source§

fn partial_cmp_by<T, U, F>(self, f: F) -> Option<Ordering>
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T, U) -> Option<Ordering> + Sync,

Compare the pairs of items produced by this iterator using lexicographic order with the comparison function f. Read more
Source§

fn partial_cmp_by_key<T, A, F>(self, f: F) -> Option<Ordering>
where Self: ParallelIterator<Item = (T, T)>, F: Fn(T) -> A + Sync, A: PartialOrd,

Compare the pairs of items produced by this iterator using lexicographic order, after mapping them with f. Read more
Source§

fn partial_cmp_by_keys<T, U, A, B, F, G>(self, f: F, g: G) -> Option<Ordering>
where Self: ParallelIterator<Item = (T, U)>, F: Fn(T) -> A + Sync, G: Fn(U) -> B + Sync, A: PartialOrd<B>,

Compare the pairs of items produced by this iterator using lexicographic order, after mapping them with f and g. Read more
Source§

fn product<T>(self) -> T
where T: Product<Self::Item> + Product<T> + Send,

Returns the product of the items produced by this iterator. Read more
Source§

fn reduce<Init, F>(self, init: Init, f: F) -> Self::Item
where Init: Fn() -> Self::Item + Sync, F: Fn(Self::Item, Self::Item) -> Self::Item + Sync, Self::Item: Send,

Reduces the items produced by this iterator into a single item, using f to collapse pairs of items. Read more
Source§

fn sum<T>(self) -> T
where T: Sum<Self::Item> + Sum<T> + Send,

Returns the sum of the items produced by this iterator. Read more
Source§

fn try_for_each<R, F>(self, f: F) -> R
where F: Fn(Self::Item) -> R + Sync, R: Try<Output = ()> + Send,

Available on crate feature nightly only.
Runs the fallible function f on each item of this parallel iterator, breaking early and returning the failure in case of failure. Read more
Source§

fn try_for_each_init<T, Init, R, F>(self, init: Init, f: F) -> R
where Init: Fn() -> T + Sync, F: Fn(&mut T, Self::Item) -> R + Sync, R: Try<Output = ()> + Send,

Available on crate feature nightly only.
Runs the fallible function f on each item of this parallel iterator, together with a per-thread mutable value returned by init, breaking early and returning the failure in case of failure. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.