Grammar in rustdoc

This commit is contained in:
David Tolnay 2016-03-10 01:55:21 -08:00
parent afc7d0e24e
commit 6d28d041cf

View file

@ -7,7 +7,7 @@ use std::mem;
use parser::*;
use scanner::{TScalarStyle, ScanError, TokenType};
/// An YAML node is store as this `Yaml` enumeration, it provides an easy way to
/// A YAML node is stored as this `Yaml` enumeration, which provides an easy way to
/// access your YAML document.
///
/// # Examples
@ -17,7 +17,7 @@ use scanner::{TScalarStyle, ScanError, TokenType};
/// let foo = Yaml::from_str("-123"); // convert the string to the appropriate YAML type
/// assert_eq!(foo.as_i64().unwrap(), -123);
///
/// // iterator over an Array
/// // iterate over an Array
/// let vec = Yaml::Array(vec![Yaml::Integer(1), Yaml::Integer(2)]);
/// for v in vec.as_vec().unwrap() {
/// assert!(v.as_i64().is_some());
@ -25,26 +25,26 @@ use scanner::{TScalarStyle, ScanError, TokenType};
/// ```
#[derive(Clone, PartialEq, PartialOrd, Debug, Eq, Ord)]
pub enum Yaml {
/// float types are stored as String, and parsed on demand.
/// Note that f64 does NOT implement Eq trait and can NOT be stored in BTreeMap
/// Float types are stored as String and parsed on demand.
/// Note that f64 does NOT implement Eq trait and can NOT be stored in BTreeMap.
Real(string::String),
/// Yaml int is stored as i64.
/// YAML int is stored as i64.
Integer(i64),
/// Yaml scalar.
/// YAML scalar.
String(string::String),
/// Yaml bool, e.g. `true` or `false`.
/// YAML bool, e.g. `true` or `false`.
Boolean(bool),
/// Yaml array, can be access as a `Vec`.
/// YAML array, can be accessed as a `Vec`.
Array(self::Array),
/// Yaml hash, can be access as a `BTreeMap`.
/// YAML hash, can be accessed as a `BTreeMap`.
Hash(self::Hash),
/// Alias, not fully supported yet.
Alias(usize),
/// Yaml bool, e.g. `null` or `~`.
/// YAML null, e.g. `null` or `~`.
Null,
/// Access non-exist node by Index trait will return `BadValue`.
/// This simplifies error handling of user. Invalid type conversion
/// also return `BadValue`.
/// Accessing a nonexistent node via the Index trait returns `BadValue`. This
/// simplifies error handling in the calling code. Invalid type conversion also
/// returns `BadValue`.
BadValue,
}