pub fn parse_yaml<S>(source: usize, yaml: S) -> Result<Node, LoadError>
where
    S: AsRef<str>,
{
    let mut loader = MarkedLoader::new(source);
    let mut parser = Parser::new(yaml.as_ref().chars());
    parser.load(&mut loader, false).map_err(|se| {
        let mark = loader.marker(*se.marker());
        LoadError::ScanError(mark, se)
    })?;
    loader.finish()
}
/// Parse YAML from a string and return a Node representing
/// the content.
///
/// When parsing YAML, the source is stored into all markers which are
/// in the node spans.  This means that later if you only have a node,
/// you can determine which source it came from without needing complex
/// lifetimes to bind strings or other non-copy data to nodes.
///
/// This library requires that the top level be a mapping, but the returned
/// type here is the generic Node enumeration to make it potentially easier
/// for callers to use.  Regardless, it's always possible to treat the
/// returned node as a mapping node without risk of panic.
///
/// ```
/// # use marked_yaml::*;
/// let node = parse_yaml(0, include_str!("../examples/everything.yaml"))
///     .unwrap()
///     .as_mapping()
///     .unwrap();
/// ```
Parse YAML from a string and return a Node representing
the content.

When parsing YAML, the source is stored into all markers which are
in the node spans.  This means that later if you only have a node,
you can determine which source it came from without needing complex
lifetimes to bind strings or other non-copy data to nodes.

This library requires that the top level be a mapping, but the returned
type here is the generic Node enumeration to make it potentially easier
for callers to use.  Regardless, it's always possible to treat the
returned node as a mapping node without risk of panic.


Parse YAML from a string and return a Node representing the content . When parsing YAML the source is stored into all markers which are in the node spans . This means that later if you only have a node you can determine which source it came from without needing complex lifetimes to bind strings or other non - copy data to nodes . This library requires that the top level be a mapping but the returned type here is the generic Node enumeration to make it potentially easier for callers to use . Regardless it ' s always possible to treat the returned node as a mapping node without risk of panic .
pub fn parse_yaml<S>(source: usize, yaml: S) -> Result<Node, LoadError>
where
    S: AsRef<str>,
{
    let mut loader = MarkedLoader::new(source);
    let mut parser = Parser::new(yaml.as_ref().chars());
    parser.load(&mut loader, false).map_err(|se| {
        let mark = loader.marker(*se.marker());
        LoadError::ScanError(mark, se)
    })?;
    loader.finish()
}
pub fn parse_yaml < S > ( source : usize , yaml : S ) -> Result < Node , LoadError > where S : AsRef < str > , { let mut loader = MarkedLoader :: new ( source ) ; let mut parser = Parser :: new ( yaml . as_ref ( ) . chars ( ) ) ; parser . load ( & mut loader , false ) . map_err ( | se | { let mark = loader . marker ( * se . marker ( ) ) ; LoadError :: ScanError ( mark , se ) } ) ? ; loader . finish ( ) }
Parse YAML from a string and return a Node representing
the content.
Parse YAML from a string and return a Node representing the content .
source
usize
yaml
S
source
usize
yaml
S
use marked_yaml::*;
let node = parse_yaml(0, include_str!("../examples/everything.yaml"))
.unwrap()
.as_mapping()
.unwrap();
```
let node = parse_yaml ( 0 include_str! ( " .. / examples / everything . yaml " )) . unwrap () . as_mapping () . unwrap () ; ` ` `