pub struct ToWriteJsonWriter<W: Write> { /* private fields */ }
Expand description
A JSON streaming writer writing to a Write
implementation.
use json_event_parser::{ToWriteJsonWriter, JsonEvent};
let mut writer = ToWriteJsonWriter::new(Vec::new());
writer.write_event(JsonEvent::StartObject)?;
writer.write_event(JsonEvent::ObjectKey("foo".into()))?;
writer.write_event(JsonEvent::Number("1".into()))?;
writer.write_event(JsonEvent::EndObject)?;
assert_eq!(writer.finish()?.as_slice(), b"{\"foo\":1}");
Implementations§
Auto Trait Implementations§
impl<W> Freeze for ToWriteJsonWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for ToWriteJsonWriter<W>where
W: RefUnwindSafe,
impl<W> Send for ToWriteJsonWriter<W>where
W: Send,
impl<W> Sync for ToWriteJsonWriter<W>where
W: Sync,
impl<W> Unpin for ToWriteJsonWriter<W>where
W: Unpin,
impl<W> UnwindSafe for ToWriteJsonWriter<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more