BlockingWrite

Trait BlockingWrite 

Source
pub trait BlockingWrite {
    type Error: Error;

    // Required method
    fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>;
}
Expand description

BlockingWrite is the library’s abstraction for blocking write I/O.

It is similar to std::io::Write, and there is a blanket implementation of BlockingWrite for any implementation of Write. The reason for introducing BlockingWrite is that it allows json-streaming to be used in a no-std environment.

Note that json-streaming writes data to a BlockingWrite in many small chunks without any I/O buffering. It is the client’s responsibility to use std::io::BufWriter or similar for improved performance where desired.

Required Associated Types§

Required Methods§

Source

fn write_all(&mut self, buf: &[u8]) -> Result<(), Self::Error>

Implementors§

Source§

impl<W: Write> BlockingWrite for W

Blanket implementation that allows any std::io::Write implementation to be used seamlessly as BlockingWrite.