Struct jomini::TextWriterBuilder[][src]

pub struct TextWriterBuilder { /* fields omitted */ }
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\n");

Implementations

impl TextWriterBuilder[src]

pub fn new() -> TextWriterBuilder[src]

Construct a new TextWriterBuilder with default values

pub fn indent_char(&mut self, indent_char: u8) -> &mut TextWriterBuilder[src]

The character to indent line.

The default is a space.

pub fn indent_factor(&mut self, indent_factor: u8) -> &mut TextWriterBuilder[src]

The number of indents per increased depth

The default is 2

pub fn from_writer<R>(&self, writer: R) -> TextWriter<R, DefaultWriteVisitor> where
    R: Write
[src]

Construct a text writer from a builder and a writer.

pub fn from_writer_visitor<R, V>(
    &self,
    writer: R,
    visitor: V
) -> TextWriter<R, V> where
    R: Write,
    V: WriteVisitor
[src]

Construct a text writer from a builder, writer, and visitor.

Trait Implementations

impl Debug for TextWriterBuilder[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl Default for TextWriterBuilder[src]

fn default() -> Self[src]

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.