Skip to main content

Module include

Module include 

Source
Available on crate feature include only.
Expand description

!include directive — resolver types (IncludeResolver, IncludeRequest, InputSource, SymlinkPolicy, SafeFileResolver). Wired into ParserConfig::include_resolver. !include directive support — compose YAML documents from multiple files via the !include path/to/file.yaml tag.

Two layers:

  • include feature (this module’s free-standing types) — defines IncludeResolver, IncludeRequest, and InputSource. The resolver is a Send + Sync closure stored on crate::ParserConfig; users wire it up via crate::ParserConfig::include_resolver.

  • include_fs feature (SafeFileResolver) — a filesystem-backed implementation with root-dir sandboxing, symlink-policy enforcement (SymlinkPolicy), and max-depth cycle protection.

Fragment anchors (!include file.yaml#name) resolve the named YAML anchor inside the included document and substitute its value rather than the whole document. Plain !include file.yaml substitutes the document root.

Cyclic includes (A includes B includes A) are rejected via a per-resolution visited set; the depth ceiling crate::ParserConfig::max_include_depth (default 24) bounds the recursion.

Structs§

IncludeRequest
Describes one !include request the loader hands to the resolver.
IncludeResolver
Resolver closure stored on crate::ParserConfig.
InputSource
What a resolver returns: the YAML text plus a stable identifier that downstream layers use for cycle detection and span-source attribution.
SafeFileResolverinclude_fs
Filesystem-backed IncludeResolver with root-dir sandboxing.

Enums§

SymlinkPolicy
How SafeFileResolver handles symbolic links it encounters while resolving a path.

Functions§

split_fragment
Split path#fragment into (path, Some(fragment)) / (path, None). Used by both the resolver and the post-parse walk so they agree on which characters are path-bytes.