Enum yaml_peg::Yaml [−][src]
pub enum Yaml { Null, Bool(bool), Int(String), Float(String), Str(String), Array(Array), Map(Map), Anchor(String), }
Expand description
YAML data types, but it is recommended to use Node
for shorten code.
This type can convert from primitive types by From
and Into
methods.
use yaml_peg::Yaml; assert_eq!(Yaml::Int("20".into()), 20.into()); assert_eq!(Yaml::Float("0.001".into()), 1e-3.into());
Also, the iterators can turn into arrays and maps.
use yaml_peg::{Yaml, yaml_array, yaml_map, node}; use std::iter::FromIterator; let v = vec![node!(1), node!(2), node!(3)]; assert_eq!(Yaml::from_iter(v), yaml_array![node!(1), node!(2), node!(3)]); let m = vec![(node!(1), node!(2)), (node!(3), node!(4))]; assert_eq!(Yaml::from_iter(m), yaml_map!{node!(1) => node!(2), node!(3) => node!(4)});
Variants
Null
Bool(bool)
Boolean
Int(String)
Integer
Float(String)
Float
Str(String)
String
Array(Array)
Array
Map(Map)
Map
Anchor(String)
Anchor insertion
Implementations
Check the anchor is valid.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Yaml
impl UnwindSafe for Yaml
Blanket Implementations
Mutably borrows from an owned value. Read more