Enumerate

Struct Enumerate 

Source
pub struct Enumerate<CS>
where CS: ConcurrentStream,
{ /* private fields */ }
Available on crate features nano-alloc and alloc only.
Expand description

A concurrent iterator that yields the current count and the element during iteration.

This struct is created by the enumerate method on ConcurrentStream. See its documentation for more.

Trait Implementations§

Source§

impl<CS> ConcurrentStream for Enumerate<CS>
where CS: ConcurrentStream,

Source§

type Item = (usize, <CS as ConcurrentStream>::Item)

Which item will we be yielding?
Source§

type Future = EnumerateFuture<<CS as ConcurrentStream>::Future, <CS as ConcurrentStream>::Item>

What’s the type of the future containing our items?
Source§

async fn drive<C>( self, consumer: C, ) -> <C as Consumer<<Enumerate<CS> as ConcurrentStream>::Item, <Enumerate<CS> as ConcurrentStream>::Future>>::Output

Internal method used to define the behavior of this concurrent iterator. You should not need to call this directly. This method causes the iterator self to start producing items and to feed them to the consumer consumer one by one.
Source§

fn concurrency_limit(&self) -> Option<NonZero<usize>>

How much concurrency should we apply?
Source§

fn size_hint(&self) -> (usize, Option<usize>)

How many items could we potentially end up returning?
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates a stream which gives the current iteration count as well as the next value. Read more
Source§

fn limit(self, limit: Option<NonZero<usize>>) -> Limit<Self>
where Self: Sized,

Obtain a simple pass-through adapter.
Source§

fn take(self, limit: usize) -> Take<Self>
where Self: Sized,

Creates a stream that yields the first n elements, or fewer if the underlying iterator ends sooner.
Source§

fn map<F, FutB, B>( self, f: F, ) -> Map<Self, F, Self::Future, Self::Item, FutB, B>
where Self: Sized, F: Fn(Self::Item) -> FutB + Clone, FutB: Future<Output = B>,

Convert items from one type into another
Source§

async fn for_each<F, Fut>(self, f: F)
where Self: Sized, F: Fn(Self::Item) -> Fut + Clone, Fut: Future<Output = ()>,

Iterate over each item concurrently
Source§

async fn try_for_each<F, Fut, E>(self, f: F) -> Result<(), E>
where Self: Sized, F: Fn(Self::Item) -> Fut + Clone, Fut: Future<Output = Result<(), E>>,

Iterate over each item concurrently, short-circuit on error. Read more
Source§

async fn collect<B>(self) -> B
where B: FromConcurrentStream<Self::Item>, Self: Sized,

Transforms an iterator into a collection.
Source§

impl<CS> Debug for Enumerate<CS>
where CS: Debug + ConcurrentStream,

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<CS> Freeze for Enumerate<CS>
where CS: Freeze,

§

impl<CS> RefUnwindSafe for Enumerate<CS>
where CS: RefUnwindSafe,

§

impl<CS> Send for Enumerate<CS>
where CS: Send,

§

impl<CS> Sync for Enumerate<CS>
where CS: Sync,

§

impl<CS> Unpin for Enumerate<CS>
where CS: Unpin,

§

impl<CS> UnwindSafe for Enumerate<CS>
where CS: 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<S> IntoConcurrentStream for S

Source§

type Item = <S as ConcurrentStream>::Item

The type of the elements being iterated over.
Source§

type IntoConcurrentStream = S

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

fn into_co_stream(self) -> <S as IntoConcurrentStream>::IntoConcurrentStream

Convert self into a concurrent iterator.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Pointee for T

Source§

type Metadata = ()

The metadata type for pointers and references to this type.
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.