yaml-rust2
[!IMPORTANT]
This crate will receive only basic maintenance and keep a stable API.
saphyrwill accept new features, at the cost of a less stable API.Please refer to #26 for more details.
yaml-rust2 is a fully compliant YAML 1.2 implementation written in pure Rust.
This work is based on yaml-rust with
fixes towards being compliant to the YAML test
suite. yaml-rust's parser is
heavily influenced by libyaml and yaml-cpp.
yaml-rust2 is a pure Rust YAML 1.2 implementation that benefits from the
memory safety and other benefits from the Rust language.
Quick Start
To add yaml-rust2 to your project, run the following in the root of your project:
Use yaml_rust2::YamlLoader to load YAML documents and access them as Yaml objects:
use ;
Note that yaml_rust2::Yaml implements Index<&'a str> and Index<usize>:
Index<usize>assumes the container is an arrayIndex<&'a str>assumes the container is a string to value map- otherwise,
Yaml::BadValueis returned
If your document does not conform to this convention (e.g. map with complex
type key), you can use the Yaml::as_XXX family API of functions to access
your objects.
Features
- Pure Rust
Vec/HashMapaccess API- Low-level YAML events emission
Security
This library does not try to interpret any type specifiers in a YAML document, so there is no risk of, say, instantiating a socket with fields and communicating with the outside world just by parsing a YAML document.
Specification Compliance
This implementation is fully compatible with the YAML 1.2 specification. In
order to help with compliance, yaml-rust2 tests against (and passes) the YAML
test suite.
Upgrading from yaml-rust
You can use yaml-rust2 as a drop-in replacement for the original yaml-rust crate.
[]
= { = "#.#", = "yaml-rust2" }
This Cargo.toml declaration allows you to refer to this crate as yaml_rust in your code.
use ;
License
Licensed under either of
- the MIT License (http://opensource.org/licenses/MIT)
- the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
at your option.
Contribution
Fork this repository and
Create a Pull Request on Github.
You may need to click on "compare across forks" and select your fork's branch.
Make sure that Ethiraric is selected as the base repository, not chyh1990.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.