uci_rs 0.1.2

an openwrt's UCI (Unified Configuration Interface) parser and serializer.
Documentation
  • Coverage
  • 0%
    0 out of 28 items documented0 out of 0 items with examples
  • Size
  • Source code size: 135.61 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.5 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • benmix

uci_rs

Test Status Crate Documents

An openwrt's UCI (Unified Configuration Interface) parser and serializer.

Usage

Add this to your Cargo.toml:

[dependencies]
uci_rs = "0.1.0"

Example:

use uci_rs::{load_config, 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 uci_network = load_config("network", "/etc/config")?;
  assert_eq!(uci.get_package(), "network");
  assert_eq!(uci.get_section("wan"), Ok(("interface", "wan" )));
  assert_eq!(uci.get_option("wan", "ifname"), Ok(("ifname", ["eth0.2"])));
  assert_eq!(uci.get_option("lan", "proto"), Ok(("proto", ["static"])));
}

Documentation

Docs.rs

License

uci_rs is distributed under the LICENSE-MIT .