pub struct MoiraiIterator<T> { /* private fields */ }Expand description
Main iterator type that adapts to different execution contexts.
Implementations§
Source§impl<T> MoiraiIterator<T>where
T: Send + 'static,
impl<T> MoiraiIterator<T>where
T: Send + 'static,
Sourcepub fn new(data: Vec<T>, context: ExecutionContext) -> MoiraiIterator<T>
pub fn new(data: Vec<T>, context: ExecutionContext) -> MoiraiIterator<T>
Create a new iterator with the given execution context.
Sourcepub fn parallel(data: Vec<T>) -> MoiraiIterator<T>
pub fn parallel(data: Vec<T>) -> MoiraiIterator<T>
Create with parallel context.
Sourcepub fn async_iter(data: Vec<T>) -> MoiraiIterator<T>
pub fn async_iter(data: Vec<T>) -> MoiraiIterator<T>
Create with async context.
Sourcepub fn hybrid(data: Vec<T>) -> MoiraiIterator<T>
pub fn hybrid(data: Vec<T>) -> MoiraiIterator<T>
Create with hybrid context.
Sourcepub fn map<F, R>(self, func: F) -> MoiraiIterator<R>
pub fn map<F, R>(self, func: F) -> MoiraiIterator<R>
Map operation that preserves the execution context.
Sourcepub async fn map_async<F, Fut, R>(self, func: F) -> MoiraiIterator<R>
pub async fn map_async<F, Fut, R>(self, func: F) -> MoiraiIterator<R>
Async map operation for I/O-bound transformations.
Sourcepub fn filter<F>(self, predicate: F) -> MoiraiIterator<T>
pub fn filter<F>(self, predicate: F) -> MoiraiIterator<T>
Filter operation.
Sourcepub async fn filter_async<F, Fut>(self, predicate: F) -> MoiraiIterator<T>
pub async fn filter_async<F, Fut>(self, predicate: F) -> MoiraiIterator<T>
Async filter operation.
Sourcepub async fn collect_async(self) -> Vec<T>
pub async fn collect_async(self) -> Vec<T>
Async collect that waits for all tasks to complete.
Sourcepub async fn reduce_parallel<F>(self, func: F) -> Option<T>
pub async fn reduce_parallel<F>(self, func: F) -> Option<T>
Parallel reduce with work-stealing.
Sourcepub async fn for_each_async<F, Fut>(self, func: F)
pub async fn for_each_async<F, Fut>(self, func: F)
Async for each operation.
Sourcepub fn into_async_stream(self) -> impl Stream<Item = T> + Send + 'staticwhere
T: 'static,
pub fn into_async_stream(self) -> impl Stream<Item = T> + Send + 'staticwhere
T: 'static,
Convert to async stream for streaming processing.
Auto Trait Implementations§
impl<T> Freeze for MoiraiIterator<T>
impl<T> RefUnwindSafe for MoiraiIterator<T>where
Vec<T>: RefUnwindSafe,
impl<T> Send for MoiraiIterator<T>
impl<T> Sync for MoiraiIterator<T>
impl<T> Unpin for MoiraiIterator<T>
impl<T> UnsafeUnpin for MoiraiIterator<T>where
Vec<T>: UnsafeUnpin,
impl<T> UnwindSafe for MoiraiIterator<T>where
Vec<T>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more