Enum yaml_peg::YamlBase [−][src]
pub enum YamlBase<R: Repr> { Null, Bool(bool), Int(String), Float(String), Str(String), Array(Array<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
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, node}; use yaml_peg::{yaml_array, yaml_map}; 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
Boolean
Int(String)
Integer
Float(String)
Float
Str(String)
String
Array(Array<R>)
Array
Map(Map<R>)
Map
Anchor(String)
Anchor insertion
Implementations
Check the anchor is valid.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more
pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
H: Hash + ?Sized,
B: BuildHasher,