Struct jomini::text::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.
Trait Implementations§
source§impl Debug for TextWriterBuilder
impl Debug for TextWriterBuilder
Auto Trait Implementations§
impl Freeze for TextWriterBuilder
impl RefUnwindSafe for TextWriterBuilder
impl Send for TextWriterBuilder
impl Sync for TextWriterBuilder
impl Unpin for TextWriterBuilder
impl UnwindSafe for TextWriterBuilder
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