NonBlockingRead

Trait NonBlockingRead 

Source
pub trait NonBlockingRead {
    type Error: Error;

    // Required method
    fn read<'life0, 'async_trait>(
        &'life0 mut self,
    ) -> Pin<Box<dyn Future<Output = Result<Option<u8>, Self::Error>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

NonBlockingRead is the library’s abstraction for non-blocking read I/O.

It is similar to tokio:io::AsyncRead, and there is a blanket implementation of NonBlockingRead for any implementation of AsyncRead. The reason for introducing NonBlockingRead is to decouple json-streaming from tokio and allow it to be used with other async frameworks.

Note that json-streaming reads data from a NonBlockingRead in many small chunks without any I/O buffering. It is the client’s responsibility to add buffering for improved performance where desired.

Required Associated Types§

Required Methods§

Source

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

Implementors§