std::encoding::yamlYAML parsing and generation.
Parse YAML documents into values, build new values programmatically, and serialize back to YAML text.
import std::encoding::yaml;
fn main() {
let doc = yaml.parse("name: Hew\nversion: 1");
let name = doc.get_field("name");
println(name.get_string()); // "Hew"
name.free();
doc.free();
}
parseParse a YAML string into a Value.
Preserves the legacy behavior: invalid YAML returns an invalid handle
(type_of() == -1). Use try_parse for a structured error result.
try_parseParse a YAML string into a Value.
Returns Err(ParseError::Invalid(message)) with the native parser message
when parsing fails. Match on ParseError::Invalid(message) to recover the
original parser message.
ParseErrorStructured error type for YAML parsing failures.
Use Result<Value, ParseError> with try_parse for structured error
handling. Import std::encoding::yaml when matching on the returned error
value so you can use the existing unqualified
ParseError::Invalid(message) constructor/pattern style.
Invalid(string)The input was not valid YAML. Carries the native parser message.
ValueAn opaque YAML value.
Represents any YAML type: null, bool, integer, float, string,
sequence, or mapping. Must be freed with free() when no longer needed.
ValueMethodsMethods available on a YAML Value.
Extends the shared opaque-handle contract from
std::encoding::wire::value_trait. Canonical methods are redeclared here
with YAML-specific docstrings for documentation purposes.
Serialize the value back to a YAML string.
Return the type tag (0=null, 1=bool, 2=i64, 3=float, 4=string, 5=sequence, 6=mapping).
Extract the boolean value (0 or 1).
Extract the integer value.
Extract the floating-point value.
Extract the string value.
Look up a field by key in a YAML mapping.
Return the number of elements in a YAML sequence.
Return the element at the given index in a YAML sequence.
Release the value resources.
Set a string field on a mapping. Returns the mapping for chaining.
Set an integer field. Returns the mapping for chaining.
Set a float field. Returns the mapping for chaining.
Set a boolean field. Returns the mapping for chaining.
Set a null field. Returns the mapping for chaining.
Set a Value child on a mapping. The child is consumed. Returns the mapping.
Push a Value onto a sequence. The child is consumed. Returns the sequence.
Push an integer onto a sequence. Returns the sequence.
Push a string onto a sequence. Returns the sequence.
Push a float onto a sequence. Returns the sequence.
Push a boolean onto a sequence. Returns the sequence.
Push null onto a sequence. Returns the sequence.