pub trait StringWriter {
// Required methods
fn write_char(&mut self, c: char);
fn write_str(&mut self, s: &str);
// Provided methods
fn writer_hint(&mut self, _expectedlen: usize) { ... }
fn as_mut_string(&mut self) -> Option<&mut String> { ... }
}Expand description
String writer used by decoders. In most cases this will be an owned string.
Required Methods§
Sourcefn write_char(&mut self, c: char)
fn write_char(&mut self, c: char)
Writes a single character.
Provided Methods§
Sourcefn writer_hint(&mut self, _expectedlen: usize)
fn writer_hint(&mut self, _expectedlen: usize)
Hints an expected lower bound on the length (in bytes) of the output
until the next call to writer_hint,
so that the writer can reserve the memory for writing.
RawDecoders are recommended but not required to call this method
with an appropriate estimate.
By default this method does nothing.
Sourcefn as_mut_string(&mut self) -> Option<&mut String>
fn as_mut_string(&mut self) -> Option<&mut String>
If this StringWriter is a String, returns a mutable reference to
self as Some(&mut String). Returns None otherwise.