Trait FutureProducer

Source
pub trait FutureProducer<D>: Send + 'static {
    type Item;

    // Required method
    fn poll_produce(
        self: Pin<&mut Self>,
        cx: &mut Context<'_>,
        store: StoreContextMut<'_, D>,
        finish: bool,
    ) -> Poll<Result<Option<Self::Item>>>;
}
Available on crate features runtime and component-model and component-model-async only.
Expand description

Represents a host-owned write end of a future.

Required Associated Types§

Source

type Item

The payload type of this future.

Required Methods§

Source

fn poll_produce( self: Pin<&mut Self>, cx: &mut Context<'_>, store: StoreContextMut<'_, D>, finish: bool, ) -> Poll<Result<Option<Self::Item>>>

Handle a host- or guest-initiated read by producing a value.

This is equivalent to StreamProducer::poll_produce, but with a simplified interface for futures.

If finish is true, the implementation may return Poll::Ready(Ok(None)) to indicate the operation was canceled before it could produce a value. Otherwise, it must either return Poll::Ready(Ok(Some(_))), Poll::Ready(Err(_)), or Poll::Pending.

Implementors§