1 unstable release

0.1.1 Sep 5, 2021
0.1.0 Sep 5, 2021

#5 in #netconf

Download history 16/week @ 2024-07-29 17/week @ 2024-09-23 3/week @ 2024-09-30 37/week @ 2024-10-14 23/week @ 2024-10-21

60 downloads per month

Apache-2.0

310KB
7.5K SLoC

yang-rs

Rust YANG parser. Supporting RFC7950.

Usage

Parse and dump a YANG file.

cargo run YANG-FILE

Code example to parse YANG string and get parsed Rust object.

use yang_rs::parser::Parser;
use yang_rs::config::Config;
use yang_rs::core::YangStmt;

let mut f = File::open(filename)?;
let mut s = String::new();

f.read_to_string(&mut s)?;

let yang = Parser::parse_yang_from_string(s, config)?;
match yang {
    YangStmt::ModuleStmt(module) => {
        println!("arg {:?}", module.arg());
        println!("arg {:?}", module.module_header().yang_version());
    }
    _ => {}
}

Dependencies

~3.5–4.5MB
~78K SLoC