pub struct StringWriter<W: Write> { /* private fields */ }Expand description
A writer that writes to an output implementing std::fmt::Write.
It’s wrapper of a basic writer with extra functionality.
Implementations§
Source§impl<W: Write> StringWriter<W>
impl<W: Write> StringWriter<W>
pub fn new(writer: W) -> Self
Sourcepub fn output_byte_counter(&self) -> u64
pub fn output_byte_counter(&self) -> u64
Returns the number of bytes that have been written to the output.
Sourcepub fn captured_chars(&self) -> Vec<char>
pub fn captured_chars(&self) -> Vec<char>
Returns a copy of the bytes that have been written to the output.
Trait Implementations§
Source§impl<W: Write> Writer for StringWriter<W>
impl<W: Write> Writer for StringWriter<W>
Source§fn write_byte(&mut self, byte: u8) -> Result<(), Error>
fn write_byte(&mut self, byte: u8) -> Result<(), Error>
It writes one byte to the output. Read more
Source§fn write_str(&mut self, value: &str) -> Result<(), Error>
fn write_str(&mut self, value: &str) -> Result<(), Error>
It writes a string to the output. Read more
Source§fn output_byte_counter(&self) -> u64
fn output_byte_counter(&self) -> u64
It return the number of bytes that have been written to the output.
Auto Trait Implementations§
impl<W> Freeze for StringWriter<W>where
W: Freeze,
impl<W> RefUnwindSafe for StringWriter<W>where
W: RefUnwindSafe,
impl<W> Send for StringWriter<W>where
W: Send,
impl<W> Sync for StringWriter<W>where
W: Sync,
impl<W> Unpin for StringWriter<W>where
W: Unpin,
impl<W> UnwindSafe for StringWriter<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