Struct yaml_rust_davvid::emitter::YamlEmitter[][src]

pub struct YamlEmitter<'a> { /* fields omitted */ }

Implementations

impl<'a> YamlEmitter<'a>[src]

pub fn new(writer: &'a mut dyn Write) -> YamlEmitter<'_>[src]

pub fn compact(&mut self, compact: bool)[src]

Set ‘compact inline notation’ on or off, as described for block sequences and mappings.

In this form, blocks cannot have any properties (such as anchors or tags), which should be OK, because this emitter doesn’t (currently) emit those anyways.

pub fn is_compact(&self) -> bool[src]

Determine if this emitter is using ‘compact inline notation’.

pub fn multiline_strings(&mut self, multiline_strings: bool)[src]

Render strings containing multiple lines in literal style.

Examples

use yaml_rust_davvid::{Yaml, YamlEmitter, YamlLoader};

let input = r#"{foo: "bar!\nbar!", baz: 42}"#;
let parsed = YamlLoader::load_from_str(input).unwrap();
eprintln!("{:?}", parsed);

let mut output = String::new();
let mut emitter = YamlEmitter::new(&mut output);
emitter.multiline_strings(true);
emitter.dump(&parsed[0]).unwrap();

assert_eq!(output.as_str(), "\
---
foo: |
  bar!
  bar!
baz: 42");

pub fn is_multiline_strings(&self) -> bool[src]

Determine if this emitter will emit multiline strings when appropriate.

pub fn dump(&mut self, doc: &Yaml) -> EmitResult[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for YamlEmitter<'a>

impl<'a> !Send for YamlEmitter<'a>

impl<'a> !Sync for YamlEmitter<'a>

impl<'a> Unpin for YamlEmitter<'a>

impl<'a> !UnwindSafe for YamlEmitter<'a>

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.