An openwrt's UCI (Unified Configuration Interface) parser and serializer.
Add this to your Cargo.toml
:
toml
[dependencies]
uci_rs = "0.1.0"
Example:
```rust use ucirs::{loadconfig, Uci, UciCommand};
/// file_path: /etc/config/network /// /// config interface 'lan' /// option type 'bridge' /// option ifname 'eth0.1' /// option proto 'static' /// option netmask '255.255.255.0' /// option ip6assign '60' /// option ipaddr '192.168.1.1' /// /// config interface 'wan' /// option ifname 'eth0.2' /// option proto 'dhcp'
fn main(){ let ucinetwork = loadconfig("network", "/etc/config")?; asserteq!(uci.getpackage(), "network"); asserteq!(uci.getsection("wan"), Ok(("interface", "wan" ))); asserteq!(uci.getoption("wan", "ifname"), Ok(("ifname", ["eth0.2"]))); asserteq!(uci.getoption("lan", "proto"), Ok(("proto", ["static"]))); } ```
uci_rs is distributed under the LICENSE-MIT .