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
traits.
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![1, 2, 3]);
let m = vec![(node!(1), node!(2)), (node!(3), node!(4))];
assert_eq!(Yaml::from_iter(m), yaml_map! { 1 => 2, 3 => 4});
Variants
Null
Bool(bool)
Boolean
Tuple Fields of Bool
0: bool
Int(String)
Integer
Tuple Fields of Int
0: String
Float(String)
Float
Tuple Fields of Float
0: String
Str(String)
String
Tuple Fields of Str
0: String
Array(Array<R>)
Array
Tuple Fields of Array
0: Array<R>
Map(Map<R>)
Map
Tuple Fields of Map
0: Map<R>
Anchor(String)
Anchor insertion
Tuple Fields of Anchor
0: String
Implementations
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: RefUnwindSafe + UnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more