pub trait NonBlockingWrite {
type Error: Error;
// Required method
fn write_all<'life0, 'life1, 'async_trait>(
&'life0 mut self,
buf: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
NonBlockingWrite is the library’s abstraction for non-blocking write I/O.
It is similar to tokio::io::AsyncWrite, and there is a blanket implementation of
NonBlockingWrite for any implementation of AsyncWrite. The reason for introducing
NonBlockingWrite is that it decouples json-streaming from tokio and allows it to be used
with other async frameworks.
Note that json-streaming writes data to a NonBlockingWrite in many small chunks without any I/O buffering. It is the client’s responsibility to add buffering for improved performance where desired.