Struct yaml_rust_davvid::emitter::YamlEmitter
source · pub struct YamlEmitter<'a> { /* private fields */ }
Implementations§
source§impl<'a> YamlEmitter<'a>
impl<'a> YamlEmitter<'a>
pub fn new(writer: &'a mut dyn Write) -> YamlEmitter<'_>
sourcepub fn is_compact(&self) -> bool
pub fn is_compact(&self) -> bool
Determine if this emitter is using ‘compact inline notation’.
sourcepub fn multiline_strings(&mut self, multiline_strings: bool)
pub fn multiline_strings(&mut self, multiline_strings: bool)
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");
sourcepub fn is_multiline_strings(&self) -> bool
pub fn is_multiline_strings(&self) -> bool
Determine if this emitter will emit multiline strings when appropriate.
pub fn dump(&mut self, doc: &Yaml) -> EmitResult
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§
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