pub struct JsonStreamWriter<W>where
W: Write,{ /* private fields */ }Expand description
A JSON writer implementation which writes data to a Write
This writer internally buffers data so it is normally not necessary to wrap the provided
writer in a std::io::BufWriter.
The data written to the underlying writer will be valid UTF-8 data if the JSON document
is finished properly by calling JsonWriter::finish_document. No leading byte order mark (BOM)
is written.
If the underlying writer returns an error of kind ErrorKind::Interrupted, this
JSON writer will keep retrying to write the data.
Implementations§
Source§impl<W> JsonStreamWriter<W>where
W: Write,
impl<W> JsonStreamWriter<W>where
W: Write,
Sourcepub fn new(writer: W) -> JsonStreamWriter<W>
pub fn new(writer: W) -> JsonStreamWriter<W>
Creates a JSON writer with default settings
Sourcepub fn new_custom(
writer: W,
writer_settings: WriterSettings,
) -> JsonStreamWriter<W>
pub fn new_custom( writer: W, writer_settings: WriterSettings, ) -> JsonStreamWriter<W>
Creates a JSON writer with custom settings
The settings can be used to customize how the JSON output will look like.
Trait Implementations§
Source§impl<W> Debug for JsonStreamWriter<W>
impl<W> Debug for JsonStreamWriter<W>
Source§impl<W> JsonWriter for JsonStreamWriter<W>where
W: Write,
impl<W> JsonWriter for JsonStreamWriter<W>where
W: Write,
Source§type WriterResult = W
type WriterResult = W
Result returned by finish_document
This JSON writer implementation returns the underlying Write to allow for
example to reuse it for other purposes. However, the JSON document is already
written during JSON writer usage, so the returned Write can be ignored in
case it is not needed for anything else.
Source§fn name(&mut self, name: &str) -> Result<(), Error>
fn name(&mut self, name: &str) -> Result<(), Error>
Source§fn end_object(&mut self) -> Result<(), Error>
fn end_object(&mut self) -> Result<(), Error>
} of the current JSON object Read moreSource§fn end_array(&mut self) -> Result<(), Error>
fn end_array(&mut self) -> Result<(), Error>
] of the current JSON object Read more