pub struct Yaml;Expand description
Parser for the yml/yaml formats: YAML into a source-located value tree.
Mappings, sequences, and scalars map to the value tree with a per-node marker Location;
YAML null becomes Value::Null. Stateless — construct with
Yaml::new.
use tanzim_parse::{Parse, yaml::Yaml};
use tanzim_source::SourceBuilder;
let source = SourceBuilder::new()
.with_source("file")
.with_resource("config.yaml")
.build()
.unwrap();
let value = Yaml::new().parse(&source, b"port: 8080\n").unwrap();
let port = value.value().as_map().unwrap().get("port").unwrap();
assert_eq!(port.value().as_int().unwrap(), 8080);Implementations§
Trait Implementations§
impl Copy for Yaml
Auto Trait Implementations§
impl Freeze for Yaml
impl RefUnwindSafe for Yaml
impl Send for Yaml
impl Sync for Yaml
impl Unpin for Yaml
impl UnsafeUnpin for Yaml
impl UnwindSafe for Yaml
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