pub struct ToTokioAsyncWriteJsonWriter<W: AsyncWrite + Unpin> { /* private fields */ }
Available on crate feature
async-tokio
only.Expand description
A JSON streaming writer writing to an AsyncWrite
implementation.
use json_event_parser::{ToTokioAsyncWriteJsonWriter, JsonEvent};
let mut writer = ToTokioAsyncWriteJsonWriter::new(Vec::new());
writer.write_event(JsonEvent::StartObject).await?;
writer.write_event(JsonEvent::ObjectKey("foo".into())).await?;
writer.write_event(JsonEvent::Number("1".into())).await?;
writer.write_event(JsonEvent::EndObject).await?;
assert_eq!(writer.finish()?.as_slice(), b"{\"foo\":1}");
Implementations§
source§impl<W: AsyncWrite + Unpin> ToTokioAsyncWriteJsonWriter<W>
impl<W: AsyncWrite + Unpin> ToTokioAsyncWriteJsonWriter<W>
Auto Trait Implementations§
impl<W> Freeze for ToTokioAsyncWriteJsonWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for ToTokioAsyncWriteJsonWriter<W>where
W: RefUnwindSafe,
impl<W> Send for ToTokioAsyncWriteJsonWriter<W>where
W: Send,
impl<W> Sync for ToTokioAsyncWriteJsonWriter<W>where
W: Sync,
impl<W> Unpin for ToTokioAsyncWriteJsonWriter<W>
impl<W> UnwindSafe for ToTokioAsyncWriteJsonWriter<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