[][src]Crate strict_yaml_rust

Strict YAML implementation in pure Rust.

Usage

This crate is on github and can be used by adding strict-yaml to the dependencies in your project's Cargo.toml.

[dependencies.strict-yaml]
git = "https://github.com/fralalonde/strict-yaml-rust.git"

And this in your crate root:

extern crate strict_yaml_rust;

Parse a string into Vec<Yaml> and then serialize it as a YAML string.

Examples

use strict_yaml_rust::{StrictYamlLoader, StrictYamlEmitter};

let docs = StrictYamlLoader::load_from_str("zug: [1, 2, 3]").unwrap();
let doc = &docs[0]; // select the first document
assert_eq!(doc["zug"].as_str(), Some("[1, 2, 3]")); // access elements by key

let mut out_str = String::new();
let mut emitter = StrictYamlEmitter::new(&mut out_str);
emitter.dump(doc).unwrap(); // dump the YAML object to a String

Re-exports

pub use scanner::ScanError;
pub use emitter::EmitError;
pub use emitter::StrictYamlEmitter;
pub use parser::Event;
pub use strict_yaml::StrictYaml;
pub use strict_yaml::StrictYamlLoader;

Modules

emitter
parser
scanner
strict_yaml