pub struct Writer<W: Write> { /* private fields */ }
Implementations§
source§impl<W: Write> DocWriter<W>
impl<W: Write> DocWriter<W>
pub fn new(writer: W) -> Self
sourcepub fn write(&mut self, doc: &Document) -> Result<(), Error>
pub fn write(&mut self, doc: &Document) -> Result<(), Error>
Serializes the document as a String, adds a newline and calls std::io::Write in the inner writer.
Does not call Self::flush, so be careful of calling it after writing
sourcepub fn write_multiple(&mut self, docs: &[Document]) -> Result<(), Error>
pub fn write_multiple(&mut self, docs: &[Document]) -> Result<(), Error>
calls Self::write for each document, returning an error if there’s any failure, then calls Self::flush.
Auto Trait Implementations§
impl<W> RefUnwindSafe for DocWriter<W>where W: RefUnwindSafe,
impl<W> Send for DocWriter<W>where W: Send,
impl<W> Sync for DocWriter<W>where W: Sync,
impl<W> Unpin for DocWriter<W>where W: Unpin,
impl<W> UnwindSafe for DocWriter<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