WaitForCompletion

Trait WaitForCompletion 

Source
pub trait WaitForCompletion<T, Args>: Backend<Args> {
    type ResultStream: Stream<Item = Result<TaskResult<T>, Self::Error>> + Send + 'static;

    // Required methods
    fn wait_for(
        &self,
        task_ids: impl IntoIterator<Item = TaskId<Self::IdType>>,
    ) -> Self::ResultStream;
    fn check_status(
        &self,
        task_ids: impl IntoIterator<Item = TaskId<Self::IdType>> + Send,
    ) -> impl Future<Output = Result<Vec<TaskResult<T>>, Self::Error>> + Send;

    // Provided method
    fn wait_for_single(
        &self,
        task_id: TaskId<Self::IdType>,
    ) -> Self::ResultStream { ... }
}
Expand description

Allows waiting for tasks to complete and checking their status

Required Associated Types§

Source

type ResultStream: Stream<Item = Result<TaskResult<T>, Self::Error>> + Send + 'static

The result stream type yielding task results

Required Methods§

Source

fn wait_for( &self, task_ids: impl IntoIterator<Item = TaskId<Self::IdType>>, ) -> Self::ResultStream

Wait for multiple tasks to complete, yielding results as they become available

Source

fn check_status( &self, task_ids: impl IntoIterator<Item = TaskId<Self::IdType>> + Send, ) -> impl Future<Output = Result<Vec<TaskResult<T>>, Self::Error>> + Send

Check current status of tasks without waiting

Provided Methods§

Source

fn wait_for_single(&self, task_id: TaskId<Self::IdType>) -> Self::ResultStream

Wait for a single task to complete, yielding its result

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<Res: 'static + DeserializeOwned + Send, Compact> WaitForCompletion<Res, Compact> for JsonStorage<Compact>
where Compact: Send + DeserializeOwned + 'static + Unpin + Sync,