Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
libyang
A YANG parser and data-modeling library written in Rust.
YANG (RFC 7950) is the data
modeling language used to describe configuration and state data for network
management protocols such as NETCONF and RESTCONF. libyang parses YANG
modules, resolves their dependencies, and turns them into a tree you can walk
to drive configuration and validation.
Features
- RFC 7950 grammar, parsed with a
parol-generated parser. - Module loading with automatic
import/include(submodule) resolution. typedef,grouping,identity, andunionresolution.- An
Entrytree suitable for building config schemas and validators.
Installation
Add it to your Cargo.toml:
[]
= "1"
Usage
Load a module by name from a search path, resolve its dependencies, and build
the Entry tree:
use ;
let mut store = new;
store.add_path; // directory containing your .yang files
// Parse the module and everything it imports/includes.
store.read_with_resolve.expect;
store.identity_resolve;
let module = store.find_module.expect;
let entry = to_entry;
println!;
For low-level access, you can parse a single file into the grammar AST directly:
use yang;
use YangGrammar;
use parse;
let input = read_to_string.unwrap;
let mut grammar = new;
parse.expect;
let node = yang.expect;
How it works
The pipeline runs in four stages:
- Parse — YANG text is parsed by the
parol-generated grammar into aYangGrammarAST. - AST —
yang()converts the grammar tree into structuredNodevalues. - Resolve —
YangStoreloads imports/includes, merges submodules, and resolves typedefs, groupings, and identities. - Entry —
to_entry()produces anEntrytree for data modeling and validation.
Testing
Integration tests live in tests/ and run against fixture modules in
tests/yang/ and the standard modules in yang/.
License
Licensed under either of Apache License, Version 2.0 or MIT license at your option.