TaskSink

Trait TaskSink 

Source
pub trait TaskSink<Args>: Backend {
    // Required methods
    fn push(
        &mut self,
        task: Args,
    ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send;
    fn push_bulk(
        &mut self,
        tasks: Vec<Args>,
    ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send;
    fn push_stream(
        &mut self,
        tasks: impl Stream<Item = Args> + Unpin + Send,
    ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send;
    fn push_task(
        &mut self,
        task: Task<Args, Self::Context, Self::IdType>,
    ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send;
    fn push_all(
        &mut self,
        tasks: impl Stream<Item = Task<Args, Self::Context, Self::IdType>> + Unpin + Send,
    ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send;
}
Expand description

Extends Backend to allow pushing tasks into the backend

Required Methods§

Source

fn push( &mut self, task: Args, ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send

Allows pushing a single task into the backend

Source

fn push_bulk( &mut self, tasks: Vec<Args>, ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send

Allows pushing multiple tasks into the backend in bulk

Source

fn push_stream( &mut self, tasks: impl Stream<Item = Args> + Unpin + Send, ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send

Allows pushing tasks from a stream into the backend

Source

fn push_task( &mut self, task: Task<Args, Self::Context, Self::IdType>, ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send

Allows pushing a fully constructed task into the backend

Source

fn push_all( &mut self, tasks: impl Stream<Item = Task<Args, Self::Context, Self::IdType>> + Unpin + Send, ) -> impl Future<Output = Result<(), TaskSinkError<Self::Error>>> + Send

Allows pushing a fully constructed task into the backend

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<Args, S, E, C> TaskSink<Args> for S
where S: Sink<Task<C::Compact, Self::Context, Self::IdType>, Error = E> + Unpin + Backend<Args = Args, Error = E, Codec = C> + Send, Args: Send, C::Compact: Send, S::Context: Send + Default, S::IdType: Send + 'static, C: Codec<Args>, E: Send, C::Error: Error + Send + Sync + 'static,