Skip to main content

parse_path

Function parse_path 

Source
pub fn parse_path(path: impl AsRef<Path>) -> Result<Schema, ParseError>
Expand description

Read a KDL schema file from disk, resolve every (<)file / (<)glob directive in it via kdl_compose::compose, then parse the composed document into a Schema.

A schema that contains no directives is composed to a document byte-equivalent to the on-disk file, so this entry is a drop-in upgrade from “read file + parse”; the only observable difference is that (<) directives now work.

§Errors

In addition to the variants from parse, returns ParseError::Compose when the composer cannot read a referenced file, detects an include cycle, or rejects a malformed directive.