pub trait Consumer<Item, Fut>where
Fut: Future<Output = Item>,{
type Output;
// Required methods
async fn send(self: Pin<&mut Self>, fut: Fut) -> ConsumerState;
async fn progress(self: Pin<&mut Self>) -> ConsumerState;
async fn flush(self: Pin<&mut Self>) -> Self::Output;
}
Expand description
Describes a type which can receive data.
§Type Generics
Item
in this context means the item that it will repeatedly receive.Future
in this context refers to the future type repeatedly submitted to it.
Required Associated Types§
Required Methods§
sourceasync fn send(self: Pin<&mut Self>, fut: Fut) -> ConsumerState
async fn send(self: Pin<&mut Self>, fut: Fut) -> ConsumerState
Send an item down to the next step in the processing queue.
sourceasync fn progress(self: Pin<&mut Self>) -> ConsumerState
async fn progress(self: Pin<&mut Self>) -> ConsumerState
Make progress on the consumer while doing something else.
It should always be possible to drop the future returned by this
function. This is solely intended to keep work going on the Consumer
while doing e.g. waiting for new futures from a stream.
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.