Struct rayon::iter::TakeAny

source ·
pub struct TakeAny<I: ParallelIterator> { /* private fields */ }
Expand description

TakeAny is an iterator that iterates over n elements from anywhere in I. This struct is created by the take_any() method on ParallelIterator

Trait Implementations§

source§

impl<I: Clone + ParallelIterator> Clone for TakeAny<I>

source§

fn clone(&self) -> TakeAny<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I: Debug + ParallelIterator> Debug for TakeAny<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I> ParallelIterator for TakeAny<I>where I: ParallelIterator,

§

type Item = <I as ParallelIterator>::Item

The type of item that this parallel iterator produces. For example, if you use the for_each method, this is the type of item that your closure will be invoked with.
source§

fn drive_unindexed<C>(self, consumer: C) -> C::Resultwhere C: UnindexedConsumer<Self::Item>,

Internal method used to define the behavior of this parallel iterator. You should not need to call this directly. Read more
source§

fn for_each<OP>(self, op: OP)where OP: Fn(Self::Item) + Sync + Send,

Executes OP on each item produced by the iterator, in parallel. Read more
source§

fn for_each_with<OP, T>(self, init: T, op: OP)where OP: Fn(&mut T, Self::Item) + Sync + Send, T: Send + Clone,

Executes OP on the given init value with each item produced by the iterator, in parallel. Read more
source§

fn for_each_init<OP, INIT, T>(self, init: INIT, op: OP)where OP: Fn(&mut T, Self::Item) + Sync + Send, INIT: Fn() -> T + Sync + Send,

Executes OP on a value returned by init with each item produced by the iterator, in parallel. Read more
source§

fn try_for_each<OP, R>(self, op: OP) -> Rwhere OP: Fn(Self::Item) -> R + Sync + Send, R: Try<Output = ()> + Send,

Executes a fallible OP on each item produced by the iterator, in parallel. Read more
source§

fn try_for_each_with<OP, T, R>(self, init: T, op: OP) -> Rwhere OP: Fn(&mut T, Self::Item) -> R + Sync + Send, T: Send + Clone, R: Try<Output = ()> + Send,

Executes a fallible OP on the given init value with each item produced by the iterator, in parallel. Read more
source§

fn try_for_each_init<OP, INIT, T, R>(self, init: INIT, op: OP) -> Rwhere OP: Fn(&mut T, Self::Item) -> R + Sync + Send, INIT: Fn() -> T + Sync + Send, R: Try<Output = ()> + Send,

Executes a fallible OP on a value returned by init with each item produced by the iterator, in parallel. Read more
source§

fn count(self) -> usize

Counts the number of items in this parallel iterator. Read more
source§

fn map<F, R>(self, map_op: F) -> Map<Self, F>where F: Fn(Self::Item) -> R + Sync + Send, R: Send,

Applies map_op to each item of this iterator, producing a new iterator with the results. Read more
source§

fn map_with<F, T, R>(self, init: T, map_op: F) -> MapWith<Self, T, F>where F: Fn(&mut T, Self::Item) -> R + Sync + Send, T: Send + Clone, R: Send,

Applies map_op to the given init value with each item of this iterator, producing a new iterator with the results. Read more
source§

fn map_init<F, INIT, T, R>(self, init: INIT, map_op: F) -> MapInit<Self, INIT, F>where F: Fn(&mut T, Self::Item) -> R + Sync + Send, INIT: Fn() -> T + Sync + Send, R: Send,

Applies map_op to a value returned by init with each item of this iterator, producing a new iterator with the results. Read more
source§

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

Creates an iterator which clones all of its elements. This may be useful when you have an iterator over &T, but you need T, and that type implements Clone. See also copied(). Read more
source§

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

Creates an iterator which copies all of its elements. This may be useful when you have an iterator over &T, but you need T, and that type implements Copy. See also cloned(). Read more
source§

fn inspect<OP>(self, inspect_op: OP) -> Inspect<Self, OP>where OP: Fn(&Self::Item) + Sync + Send,

Applies inspect_op to a reference to each item of this iterator, producing a new iterator passing through the original items. This is often useful for debugging to see what’s happening in iterator stages. Read more
source§

fn update<F>(self, update_op: F) -> Update<Self, F>where F: Fn(&mut Self::Item) + Sync + Send,

Mutates each item of this iterator before yielding it. Read more
source§

fn filter<P>(self, filter_op: P) -> Filter<Self, P>where P: Fn(&Self::Item) -> bool + Sync + Send,

Applies filter_op to each item of this iterator, producing a new iterator with only the items that gave true results. Read more
source§

fn filter_map<P, R>(self, filter_op: P) -> FilterMap<Self, P>where P: Fn(Self::Item) -> Option<R> + Sync + Send, R: Send,

Applies filter_op to each item of this iterator to get an Option, producing a new iterator with only the items from Some results. Read more
source§

fn flat_map<F, PI>(self, map_op: F) -> FlatMap<Self, F>where F: Fn(Self::Item) -> PI + Sync + Send, PI: IntoParallelIterator,

Applies map_op to each item of this iterator to get nested parallel iterators, producing a new parallel iterator that flattens these back into one. Read more
source§

fn flat_map_iter<F, SI>(self, map_op: F) -> FlatMapIter<Self, F>where F: Fn(Self::Item) -> SI + Sync + Send, SI: IntoIterator, SI::Item: Send,

Applies map_op to each item of this iterator to get nested serial iterators, producing a new parallel iterator that flattens these back into one. Read more
source§

fn reduce<OP, ID>(self, identity: ID, op: OP) -> Self::Itemwhere OP: Fn(Self::Item, Self::Item) -> Self::Item + Sync + Send, ID: Fn() -> Self::Item + Sync + Send,

Reduces the items in the iterator into one item using op. The argument identity should be a closure that can produce “identity” value which may be inserted into the sequence as needed to create opportunities for parallel execution. So, for example, if you are doing a summation, then identity() ought to produce something that represents the zero for your type (but consider just calling sum() in that case). Read more
source§

fn reduce_with<OP>(self, op: OP) -> Option<Self::Item>where OP: Fn(Self::Item, Self::Item) -> Self::Item + Sync + Send,

Reduces the items in the iterator into one item using op. If the iterator is empty, None is returned; otherwise, Some is returned. Read more
source§

fn fold<T, ID, F>(self, identity: ID, fold_op: F) -> Fold<Self, ID, F>where F: Fn(T, Self::Item) -> T + Sync + Send, ID: Fn() -> T + Sync + Send, T: Send,

Parallel fold is similar to sequential fold except that the sequence of items may be subdivided before it is folded. Consider a list of numbers like 22 3 77 89 46. If you used sequential fold to add them (fold(0, |a,b| a+b), you would wind up first adding 0 + 22, then 22 + 3, then 25 + 77, and so forth. The parallel fold works similarly except that it first breaks up your list into sublists, and hence instead of yielding up a single sum at the end, it yields up multiple sums. The number of results is nondeterministic, as is the point where the breaks occur. Read more
source§

fn fold_with<F, T>(self, init: T, fold_op: F) -> FoldWith<Self, T, F>where F: Fn(T, Self::Item) -> T + Sync + Send, T: Send + Clone,

Applies fold_op to the given init value with each item of this iterator, finally producing the value for further use. Read more
source§

fn try_fold<T, R, ID, F>( self, identity: ID, fold_op: F ) -> TryFold<Self, R, ID, F>where F: Fn(T, Self::Item) -> R + Sync + Send, ID: Fn() -> T + Sync + Send, R: Try<Output = T> + Send,

Performs a fallible parallel fold. Read more
source§

fn try_fold_with<F, T, R>(self, init: T, fold_op: F) -> TryFoldWith<Self, R, F>where F: Fn(T, Self::Item) -> R + Sync + Send, R: Try<Output = T> + Send, T: Clone + Send,

Performs a fallible parallel fold with a cloneable init value. Read more
source§

fn sum<S>(self) -> Swhere S: Send + Sum<Self::Item> + Sum<S>,

Sums up the items in the iterator. Read more
source§

fn product<P>(self) -> Pwhere P: Send + Product<Self::Item> + Product<P>,

Multiplies all the items in the iterator. Read more
source§

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

Computes the minimum of all the items in the iterator with respect to the given comparison function. If the iterator is empty, None is returned; otherwise, Some(min) is returned. Read more
source§

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

Computes the item that yields the minimum value for the given function. If the iterator is empty, None is returned; otherwise, Some(item) is returned. Read more
source§

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

Computes the maximum of all the items in the iterator with respect to the given comparison function. If the iterator is empty, None is returned; otherwise, Some(min) is returned. Read more
source§

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

Computes the item that yields the maximum value for the given function. If the iterator is empty, None is returned; otherwise, Some(item) is returned. Read more
source§

fn chain<C>(self, chain: C) -> Chain<Self, C::Iter>where C: IntoParallelIterator<Item = Self::Item>,

Takes two iterators and creates a new iterator over both. Read more
source§

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

Searches for some item in the parallel iterator that matches the given predicate and returns it. This operation is similar to find on sequential iterators but the item returned may not be the first one in the parallel sequence which matches, since we search the entire sequence in parallel. Read more
source§

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

Searches for the sequentially first item in the parallel iterator that matches the given predicate and returns it. Read more
source§

fn find_last<P>(self, predicate: P) -> Option<Self::Item>where P: Fn(&Self::Item) -> bool + Sync + Send,

Searches for the sequentially last item in the parallel iterator that matches the given predicate and returns it. Read more
source§

fn find_map_any<P, R>(self, predicate: P) -> Option<R>where P: Fn(Self::Item) -> Option<R> + Sync + Send, R: Send,

Applies the given predicate to the items in the parallel iterator and returns any non-None result of the map operation. Read more
source§

fn find_map_first<P, R>(self, predicate: P) -> Option<R>where P: Fn(Self::Item) -> Option<R> + Sync + Send, R: Send,

Applies the given predicate to the items in the parallel iterator and returns the sequentially first non-None result of the map operation. Read more
source§

fn find_map_last<P, R>(self, predicate: P) -> Option<R>where P: Fn(Self::Item) -> Option<R> + Sync + Send, R: Send,

Applies the given predicate to the items in the parallel iterator and returns the sequentially last non-None result of the map operation. Read more
source§

fn any<P>(self, predicate: P) -> boolwhere P: Fn(Self::Item) -> bool + Sync + Send,

Searches for some item in the parallel iterator that matches the given predicate, and if so returns true. Once a match is found, we’ll attempt to stop process the rest of the items. Proving that there’s no match, returning false, does require visiting every item. Read more
source§

fn all<P>(self, predicate: P) -> boolwhere P: Fn(Self::Item) -> bool + Sync + Send,

Tests that every item in the parallel iterator matches the given predicate, and if so returns true. If a counter-example is found, we’ll attempt to stop processing more items, then return false. Read more
source§

fn while_some<T>(self) -> WhileSome<Self>where Self: ParallelIterator<Item = Option<T>>, T: Send,

Creates an iterator over the Some items of this iterator, halting as soon as any None is found. Read more
source§

fn panic_fuse(self) -> PanicFuse<Self>

Wraps an iterator with a fuse in case of panics, to halt all threads as soon as possible. Read more
source§

fn collect<C>(self) -> Cwhere C: FromParallelIterator<Self::Item>,

Creates a fresh collection containing all the elements produced by this parallel iterator. Read more
source§

fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)where Self: ParallelIterator<Item = (A, B)>, FromA: Default + Send + ParallelExtend<A>, FromB: Default + Send + ParallelExtend<B>, A: Send, B: Send,

Unzips the items of a parallel iterator into a pair of arbitrary ParallelExtend containers. Read more
source§

fn partition<A, B, P>(self, predicate: P) -> (A, B)where A: Default + Send + ParallelExtend<Self::Item>, B: Default + Send + ParallelExtend<Self::Item>, P: Fn(&Self::Item) -> bool + Sync + Send,

Partitions the items of a parallel iterator into a pair of arbitrary ParallelExtend containers. Items for which the predicate returns true go into the first container, and the rest go into the second. Read more
source§

fn partition_map<A, B, P, L, R>(self, predicate: P) -> (A, B)where A: Default + Send + ParallelExtend<L>, B: Default + Send + ParallelExtend<R>, P: Fn(Self::Item) -> Either<L, R> + Sync + Send, L: Send, R: Send,

Partitions and maps the items of a parallel iterator into a pair of arbitrary ParallelExtend containers. Either::Left items go into the first container, and Either::Right items go into the second. Read more
source§

fn take_any(self, n: usize) -> TakeAny<Self>

Creates an iterator that yields n elements from anywhere in the original iterator. Read more
source§

fn skip_any(self, n: usize) -> SkipAny<Self>

Creates an iterator that skips n elements from anywhere in the original iterator. Read more
source§

fn take_any_while<P>(self, predicate: P) -> TakeAnyWhile<Self, P>where P: Fn(&Self::Item) -> bool + Sync + Send,

Creates an iterator that takes elements from anywhere in the original iterator until the given predicate returns false. Read more
source§

fn skip_any_while<P>(self, predicate: P) -> SkipAnyWhile<Self, P>where P: Fn(&Self::Item) -> bool + Sync + Send,

Creates an iterator that skips elements from anywhere in the original iterator until the given predicate returns false. Read more
source§

fn opt_len(&self) -> Option<usize>

Internal method used to define the behavior of this parallel iterator. You should not need to call this directly. Read more

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for TakeAny<I>where I: RefUnwindSafe,

§

impl<I> Send for TakeAny<I>

§

impl<I> Sync for TakeAny<I>where I: Sync,

§

impl<I> Unpin for TakeAny<I>where I: Unpin,

§

impl<I> UnwindSafe for TakeAny<I>where I: UnwindSafe,

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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> IntoParallelIterator for Twhere T: ParallelIterator,

§

type Iter = T

The parallel iterator type that will be created.
§

type Item = <T as ParallelIterator>::Item

The type of item that the parallel iterator will produce.
source§

fn into_par_iter(self) -> T

Converts self into a parallel iterator. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.