@std/data/yaml.ms#
Import each required symbol with import Name from "@std/data/yaml.ms".
YamlOptions Type#
Limits for parse and parse_all on input bytes, nesting depth and parsed values.
A limit set to null adds no limit. The defaults, depth 10,000 and 1,000,000 values,
guard against deep nesting and alias expansion. A negative limit returns EINVAL,
and a document that exceeds one returns EOVERFLOW.
type YamlOptions {
max_bytes Int? = null
max_depth Int? = 10000
max_values Int? = 1000000
}YamlOptions.max_bytes#
Maximum UTF-8 input bytes before line-ending normalization; null adds no budget.
max_bytes Int? = nullYamlOptions.max_depth#
Maximum value depth, including scalar leaves, with the root at one.
max_depth Int? = 10000YamlOptions.max_values#
Maximum containers and leaves, excluding keys; aliases count at each checked occurrence.
max_values Int? = 1000000YamlValue Enum#
A YAML value represented as null, boolean, number text, string, array, or object.
enum YamlValue {
Null
BoolValue(value Bool)
NumberValue(text String)
StringValue(value String)
ArrayValue(values List[YamlValue])
ObjectValue(values Map[String, YamlValue])
}YamlValue.ArrayValue#
An ordered YAML sequence with ordinary mutable list storage.
ArrayValue(values List[YamlValue])YamlValue.BoolValue#
A core-schema true or false value; yes and no remain strings.
BoolValue(value Bool)YamlValue.Null#
YAML null, including an empty document or a plain null spelling.
NullYamlValue.NumberValue#
Numeric token text retained exactly instead of being coerced into Float.
NumberValue(text String)YamlValue.ObjectValue#
A textual-key mapping, with insertion order and duplicate-key checks.
ObjectValue(values Map[String, YamlValue])YamlValue.StringValue#
Text decoded from a quoted, plain or block scalar.
StringValue(value String)YamlValue.ArrayValue.values#
Sequence entries in document order, retaining nested references.
values List[YamlValue]YamlValue.BoolValue.value#
The decoded boolean selected from YAML core-schema spellings.
value BoolYamlValue.NumberValue.text#
Original numeric spelling, including supported base prefixes and nonfinite spellings.
text StringYamlValue.ObjectValue.values#
Decoded string keys and their values; aliases may share nested payloads.
values Map[String, YamlValue]YamlValue.StringValue.value#
Resulting Unicode text after escape decoding, folding and chomping.
value Stringparse Function#
Parses a single YAML document. A stream of several documents is an error; use
parse_all for it. Invalid input returns EBADMSG and unsupported YAML syntax returns
ENOTSUP; both errors include the source location.
fn parse(text String, options YamlOptions = YamlOptions()) Result[YamlValue, Error] { ... }parse_all Function#
Parses a stream of YAML documents separated by --- or ended by ..., returning one
value per document in order. A document with no content is null; input with no
document at all is an empty list. Anchors, tag handles and limits apply to each
document on its own.
fn parse_all(text String, options YamlOptions = YamlOptions()) Result[List[YamlValue], Error] { ... }stringify Function#
Writes a YAML value in block style with double-quoted strings. Output longer than
max_bytes returns EOVERFLOW, and a negative max_bytes returns EINVAL.
fn stringify(value YamlValue, max_bytes Int? = null) Result[String, Error] { ... }