Enum yaml_peg::YamlBase [−][src]
pub enum YamlBase<R: Repr> {
Null,
Bool(bool),
Int(String),
Float(String),
Str(String),
Seq(Seq<R>),
Map(Map<R>),
Anchor(String),
}Expand description
YAML data types, but it is recommended to use NodeBase for shorten code.
This type can convert from primitive types by From and Into traits.
use yaml_peg::Yaml;
assert_eq!(Yaml::Int("20".to_string()), Yaml::from(20));
assert_eq!(Yaml::Float("0.001".to_string()), 1e-3.into());Also, the iterators can turned to sequence and map.
use yaml_peg::{node, Yaml};
use std::iter::FromIterator;
let v = vec![node!(1), node!(2), node!(3)];
assert_eq!(Yaml::Seq(v.clone()), Yaml::from_iter(v));
let m = vec![(node!(1), node!(2)), (node!(3), node!(4))];
assert_eq!(Yaml::Map(m.clone().into_iter().collect()), Yaml::from_iter(m));Variants
Null
Bool(bool)Boolean
Tuple Fields of Bool
0: boolInt(String)Integer
Tuple Fields of Int
0: StringFloat(String)Float
Tuple Fields of Float
0: StringStr(String)String
Tuple Fields of Str
0: StringSeq(Seq<R>)Sequence
Tuple Fields of Seq
0: Seq<R>Map(Map<R>)Map
Tuple Fields of Map
0: Map<R>Anchor(String)Anchor insertion
Tuple Fields of Anchor
0: StringImplementations
Check the anchor is valid.
Trait Implementations
Auto Trait Implementations
impl<R> RefUnwindSafe for YamlBase<R> where
R: RefUnwindSafe,
impl<R> UnwindSafe for YamlBase<R> where
R: UnwindSafe + RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more