pub struct TokioAsyncWriterJsonSerializer<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::{JsonEvent, TokioAsyncWriterJsonSerializer};
let mut writer = TokioAsyncWriterJsonSerializer::new(Vec::new());
writer.serialize_event(JsonEvent::StartObject).await?;
writer
.serialize_event(JsonEvent::ObjectKey("foo".into()))
.await?;
writer
.serialize_event(JsonEvent::Number("1".into()))
.await?;
writer.serialize_event(JsonEvent::EndObject).await?;
assert_eq!(writer.finish()?.as_slice(), b"{\"foo\":1}");
Implementations§
Source§impl<W: AsyncWrite + Unpin> TokioAsyncWriterJsonSerializer<W>
impl<W: AsyncWrite + Unpin> TokioAsyncWriterJsonSerializer<W>
Auto Trait Implementations§
impl<W> Freeze for TokioAsyncWriterJsonSerializer<W>where
W: Freeze,
impl<W> RefUnwindSafe for TokioAsyncWriterJsonSerializer<W>where
W: RefUnwindSafe,
impl<W> Send for TokioAsyncWriterJsonSerializer<W>where
W: Send,
impl<W> Sync for TokioAsyncWriterJsonSerializer<W>where
W: Sync,
impl<W> Unpin for TokioAsyncWriterJsonSerializer<W>
impl<W> UnwindSafe for TokioAsyncWriterJsonSerializer<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