Skip to main content

Module path

Module path 

Source
Expand description

Path-based access to YAML documents.

Provides convenient dot-separated path syntax for accessing nested YAML values like "server.host" or "database.primary.port".

Operations: get_path, set_path, remove_path

§Example

use yaml_edit::{Document, path::YamlPath};
use std::str::FromStr;

let yaml = Document::from_str("server:\n  host: localhost\n  port: 8080\n").unwrap();

// Get nested values
let host = yaml.get_path("server.host");

// Set nested values (creates intermediate mappings)
yaml.set_path("database.primary.host", "db.example.com");

// Remove nested values
yaml.remove_path("server.port");

All operations preserve formatting, comments, and whitespace.

Enums§

PathSegment
Represents a segment in a YAML path.

Traits§

YamlPath
Trait for YAML types that support path-based access.

Functions§

parse_path
Parse a path string into components.