Skip to main content

StreamSender

Trait StreamSender 

Source
pub trait StreamSender: Send + Sync {
    // Required methods
    fn send_chunk<'life0, 'life1, 'async_trait>(
        &'life0 self,
        chunk: &'life1 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_json<'life0, 'life1, 'async_trait>(
        &'life0 self,
        data: &'life1 Value,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn close<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn is_closed(&self) -> bool;
}
Expand description

Stream sender for sending chunks

Required Methods§

Source

fn send_chunk<'life0, 'life1, 'async_trait>( &'life0 self, chunk: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send a chunk

Source

fn send_json<'life0, 'life1, 'async_trait>( &'life0 self, data: &'life1 Value, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Send JSON chunk

Source

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

Close the stream

Source

fn is_closed(&self) -> bool

Check if stream is closed

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§