StreamHandle

Trait StreamHandle 

Source
pub trait StreamHandle: MaybeSend + MaybeSync {
    type StreamOutput;

    // Required methods
    fn wait_for_ready<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn end(&self);
    fn join<'async_trait>(
        self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::StreamOutput, StreamHandleError>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn end_and_wait<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Self::StreamOutput, StreamHandleError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn abort_handle(&self) -> Box<dyn AbortHandle>;
}
Expand description

A handle to a spawned Stream the spawned stream can be ’joined` by awaiting its Future implementation. All spawned tasks are detached, so waiting the handle is not required.

Required Associated Types§

Source

type StreamOutput

The Output type for the stream

Required Methods§

Source

fn wait_for_ready<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Asynchronously waits for the stream to be fully spawned

Source

fn end(&self)

Signal the stream to end Does not wait for the stream to end, so will not receive the result of stream.

Source

fn join<'async_trait>( self, ) -> Pin<Box<dyn Future<Output = Result<Self::StreamOutput, StreamHandleError>> + Send + 'async_trait>>
where Self: 'async_trait,

Join the task back to the current thread, waiting until it ends.

Source

fn end_and_wait<'life0, 'async_trait>( &'life0 mut self, ) -> Pin<Box<dyn Future<Output = Result<Self::StreamOutput, StreamHandleError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

End the stream and asynchronously wait for it to shutdown, getting the result of its execution.

Source

fn abort_handle(&self) -> Box<dyn AbortHandle>

Get an Abort Handle to the stream. This handle may be cloned/sent/etc easily and many handles may exist at once.

Implementors§