Struct jomini::TextWriterBuilder
source · pub struct TextWriterBuilder { /* private fields */ }
Expand description
Construct a customized text writer
use jomini::TextWriterBuilder;
let mut out: Vec<u8> = Vec::new();
let mut writer = TextWriterBuilder::new().from_writer(&mut out);
writer.write_unquoted(b"hello")?;
writer.write_unquoted(b"world")?;
assert_eq!(std::str::from_utf8(&out).unwrap(), "hello=world");
Implementations§
source§impl TextWriterBuilder
impl TextWriterBuilder
sourcepub fn new() -> TextWriterBuilder
pub fn new() -> TextWriterBuilder
Construct a new TextWriterBuilder with default values
sourcepub fn indent_char(&mut self, indent_char: u8) -> &mut TextWriterBuilder
pub fn indent_char(&mut self, indent_char: u8) -> &mut TextWriterBuilder
The character to indent line.
The default is a space.
sourcepub fn indent_factor(&mut self, indent_factor: u8) -> &mut TextWriterBuilder
pub fn indent_factor(&mut self, indent_factor: u8) -> &mut TextWriterBuilder
The number of indents per increased depth
The default is 2
sourcepub fn from_writer<R>(&self, writer: R) -> TextWriter<R>where
R: Write,
pub fn from_writer<R>(&self, writer: R) -> TextWriter<R>where
R: Write,
Construct a text writer from a builder and a writer.