Struct MaybeParallelIterator

Source
pub struct MaybeParallelIterator<IT: Iterator>(/* private fields */);
Expand description

An iterator that may be sequential or parallel depending on feature flags.

Implementations§

Source§

impl<IT: Iterator> MaybeParallelIterator<IT>

Source

pub fn collect<B: FromIterator<IT::Item>>(self) -> B
where Self: Sized,

Source

pub fn for_each<O: Fn(IT::Item)>(self, op: O)

Do a computation on all items.

Source

pub fn with_min_sequential(self, _: usize) -> Self

Process at least this many items sequentially (no-op unless rayon feature enabled).

§Foot-gun

Without rayon feature, this can be called in places IndexedParallelIterator would not apply. These uses won’t compile under rayon.

Source

pub fn enumerate(self) -> MaybeParallelIterator<Enumerate<IT>>

Map to a tuple containing the index of each item along with that item.

§Foot-gun

Without rayon feature, this can be called in places IndexedParallelIterator would not apply. These uses won’t compile under rayon.

Source

pub fn map<O, M: Fn(IT::Item) -> O>( self, map: M, ) -> MaybeParallelIterator<Map<IT, M>>

Like iterator mapping.

Source

pub fn filter_map<O, M: Fn(IT::Item) -> Option<O>>( self, map: M, ) -> MaybeParallelIterator<FilterMap<IT, M>>

Like iterator filter mapping.

Source

pub fn flat_map<O: IntoIterator, M: Fn(IT::Item) -> O>( self, map: M, ) -> MaybeParallelIterator<FlatMap<IT, O, M>>

Like iterator flat-mapping.

Source

pub fn find_any<F: Fn(&IT::Item) -> bool>(self, f: F) -> Option<IT::Item>

Like iterator find (but won’t necessarily return the first match).

Source

pub fn into_inner(self) -> IT

Get the inner iterator.

Trait Implementations§

Source§

impl<IT: Iterator> IntoIterator for MaybeParallelIterator<IT>

Source§

type Item = <IT as Iterator>::Item

The type of the elements being iterated over.
Source§

type IntoIter = IT

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more

Auto Trait Implementations§

§

impl<IT> Freeze for MaybeParallelIterator<IT>
where IT: Freeze,

§

impl<IT> RefUnwindSafe for MaybeParallelIterator<IT>
where IT: RefUnwindSafe,

§

impl<IT> Send for MaybeParallelIterator<IT>
where IT: Send,

§

impl<IT> Sync for MaybeParallelIterator<IT>
where IT: Sync,

§

impl<IT> Unpin for MaybeParallelIterator<IT>
where IT: Unpin,

§

impl<IT> UnwindSafe for MaybeParallelIterator<IT>
where IT: 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<IIT> IntoMaybeParallelIterator for IIT
where IIT: IntoIterator,

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.