rustnetconf_yang/lib.rs
1//! # rustnetconf-yang
2//!
3//! YANG model code generation for rustnetconf. Generates typed Rust structs
4//! from YANG models so your network config is validated at compile time.
5//!
6//! ## How it works
7//!
8//! 1. Place `.yang` model files in your project's `yang-models/` directory
9//! 2. Add `rustnetconf-yang` as a dependency
10//! 3. Run `cargo build` — the build script generates Rust structs in `OUT_DIR`
11//! 4. Use the generated types with `edit_config_typed()`
12//!
13//! ```rust,ignore
14//! // Generated from ietf-interfaces.yang:
15//! use rustnetconf_yang::ietf_interfaces::Interfaces;
16//!
17//! let config = Interfaces {
18//! interface: vec![Interface {
19//! name: "ge-0/0/0".into(),
20//! description: Some("uplink".into()),
21//! enabled: Some(true),
22//! ..Default::default()
23//! }],
24//! };
25//! ```
26
27pub mod serialize;
28
29// Re-export generated types when available
30// The build.rs generates code into OUT_DIR, which is included here.
31#[cfg(feature = "generated")]
32include!(concat!(env!("OUT_DIR"), "/yang_generated.rs"));