pub struct BatchExecutor<T> { /* private fields */ }
Expand description
A batch executor for running multiple tasks and collecting their results
Implementations§
Source§impl<T: Send + 'static> BatchExecutor<T>
impl<T: Send + 'static> BatchExecutor<T>
Sourcepub fn new(thread_pool: Arc<ThreadPool>) -> Self
pub fn new(thread_pool: Arc<ThreadPool>) -> Self
Create a new batch executor with the given thread pool
Sourcepub fn add_task_fn<F>(&mut self, f: F, priority: usize)
pub fn add_task_fn<F>(&mut self, f: F, priority: usize)
Add a task from a closure to the batch
Sourcepub async fn execute(self) -> Vec<ThreadPoolResult<T>> ⓘ
pub async fn execute(self) -> Vec<ThreadPoolResult<T>> ⓘ
Execute all tasks and collect their results
Sourcepub fn execute_stream(self) -> impl Stream<Item = ThreadPoolResult<T>>
pub fn execute_stream(self) -> impl Stream<Item = ThreadPoolResult<T>>
Execute all tasks and return a stream of results as they complete
Auto Trait Implementations§
impl<T> Freeze for BatchExecutor<T>
impl<T> !RefUnwindSafe for BatchExecutor<T>
impl<T> Send for BatchExecutor<T>
impl<T> !Sync for BatchExecutor<T>
impl<T> Unpin for BatchExecutor<T>
impl<T> !UnwindSafe for BatchExecutor<T>
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