This package is a fork of serde-yaml, designed to provide (mostly) panic-free operation. Specifically, it should not panic when encountering malformed YAML syntax. This makes the library suitable for safely parsing user-supplied YAML content.
This increased safety comes at the cost of some API restrictions: write access to indices and mappings has been removed. Read access remains possible, with Value::Null returned on invalid access. Also, from 2.0.1, duplicate keys are not longer permitted in YAML, returning proper error message instead.
We do not encourage using this crate beyond serialization with serde. If your use-case requires additional functionality, there are better-suited crates available, such as yaml-rust2 and the newer, more experimental saphyr, both capable of handling valid YAML that is not directly representable with Rust structures.
Since the API has changed to a more restrictive version, the major version number has been incremented.
If a panic does occur under some short and clear input, please report it as a bug.
Usage Example
Here's a concise example demonstrating how to parse YAML into a Rust structure using serde_yaml_bw with proper error
handling:
use ;
// Define the structure representing your YAML data.