diff --git a/libuci-sys/Cargo.toml b/libuci-sys/Cargo.toml index 5a6c80a..c12d28d 100644 --- a/libuci-sys/Cargo.toml +++ b/libuci-sys/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "libuci-sys" -version = "1.0.5" -authors = ["Benjamin Ludewig "] +version = "1.1.0" +authors = ["Benjamin Ludewig ", "Hugo Hakim Damer "] description = "FFI bindings to OpenWRT UCI" license = "MIT OR Apache-2.0" repository = "https://github.com/namib-project/libuci-sys" @@ -16,4 +16,4 @@ targets = ["x86_64-unknown-linux-gnu"] [build-dependencies] bindgen = "^0.58.1" -cmake = "^0.1.45" \ No newline at end of file +cmake = "^0.1.45" diff --git a/rust-uci/Cargo.toml b/rust-uci/Cargo.toml index 8d8f9d4..5772d92 100644 --- a/rust-uci/Cargo.toml +++ b/rust-uci/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "rust-uci" -version = "0.1.5" -authors = ["Benjamin Ludewig "] +version = "0.1.6" +authors = ["Benjamin Ludewig ", "Hugo Hakim Damer "] description = "OpenWRT UCI rust bindings" repository = "https://github.com/namib-project/libuci-sys" keywords = ["openwrt"] @@ -13,6 +13,6 @@ edition = "2018" targets = ["x86_64-unknown-linux-gnu"] [dependencies] -libuci-sys = { version = "1.0.5", path = "../libuci-sys" } +libuci-sys = { version = "^1.1.0", path = "../libuci-sys" } log = "^0.4.14" -libc = "^0.2.91" \ No newline at end of file +libc = "^0.2.91" diff --git a/rust-uci/src/lib.rs b/rust-uci/src/lib.rs index 2b76ba7..47e1bd7 100644 --- a/rust-uci/src/lib.rs +++ b/rust-uci/src/lib.rs @@ -25,24 +25,25 @@ //! ```no_run //! use rust_uci::Uci; //! -//! let mut uci = Uci::new()?; +//! let mut uci = Uci::new().expect("unable to create UCI context"); //! // Get type of a section -//! assert_eq!(uci.get("network.wan")?, "interface"); +//! assert_eq!(uci.get("network.wan").expect("unable to get value for network.wan"), "interface"); //! // Get value of an option, UCI's extended syntax is supported -//! assert_eq!(uci.get("network.@interface[0].proto")?, "static"); -//! assert_eq!(uci.get("network.lan.proto")?, "static"); +//! assert_eq!(uci.get("network.@interface[0].proto").expect("unable to get value for network.@interface[0].proto"), "static"); +//! assert_eq!(uci.get("network.lan.proto").expect("unable to get value for network.lan.proto"), "static"); //! //! // Create a new section -//! uci.set("network.newnet", "interface")?; -//! uci.set("network.newnet.proto", "static")?; -//! uci.set("network.newnet.ifname", "en0")?; -//! uci.set("network.newnet.enabled", "1")?; -//! uci.set("network.newnet.ipaddr", "2.3.4.5")?; -//! uci.set("network.newnet.test", "123")?; -//! uci.delete("network.newnet.test")?; +//! uci.set("network.newnet", "interface").expect("unable to set network.newnet"); +//! uci.set("network.newnet.proto", "static").expect("unable to set network.newnet.proto"); +//! uci.set("network.newnet.ifname", "en0").expect("unable to set network.newnet.ifname"); +//! uci.set("network.newnet.enabled", "1").expect("unable to set network.newnet.enabled"); +//! uci.set("network.newnet.ipaddr", "2.3.4.5").expect("unable to set network.newnet.ipaddr"); +//! uci.set("network.newnet.test", "123").expect("unable to set network.newnet.test"); +//! // Delete option +//! uci.delete("network.newnet.test").expect("unable to delete network.newnet.test"); //! // IMPORTANT: Commit or revert the changes -//! uci.commit("network")?; -//! uci.revert("network")?; +//! uci.commit("network").expect("unable to commit changes"); +//! uci.revert("network").expect("unable to revert changes"); //! //! ```