Struct rust_uci::Uci[][src]

pub struct Uci(_);
Expand description

Contains the native uci_context

Implementations

impl Uci[src]

pub fn new() -> Result<Uci>[src]

Creates a new UCI context. The C memory will be freed when the object is dropped.

pub fn set_config_dir(&mut self, config_dir: &str) -> Result<()>[src]

Sets the config directory of UCI, this is /etc/config by default.

pub fn set_save_dir(&mut self, save_dir: &str) -> Result<()>[src]

Sets the save directory of UCI, this is /tmp/.uci by default.

pub fn delete(&mut self, identifier: &str) -> Result<()>[src]

Delete an option or section in UCI. UCI will keep the delta changes in a temporary location until commit() or revert() is called.

Allowed keys are like network.wan.proto, network.@interface[-1].iface, network.wan and network.@interface[-1]

if the deletion failed an Err is returned.

pub fn revert(&mut self, identifier: &str) -> Result<()>[src]

Revert changes to an option, section or package

Allowed keys are like network, network.wan.proto, network.@interface[-1].iface, network.wan and network.@interface[-1]

if the deletion failed an Err is returned.

pub fn set(&mut self, identifier: &str, val: &str) -> Result<()>[src]

Sets an option value or section type in UCI, creates the key if necessary. UCI will keep the delta changes in a temporary location until commit() or revert() is called.

Allowed keys are like network.wan.proto, network.@interface[-1].iface, network.wan and network.@interface[-1]

if the assignment failed an Err is returned.

pub fn commit(&mut self, package: &str) -> Result<()>[src]

Commit all changes to the specified package writing the temporary delta to the config file

pub fn get(&mut self, key: &str) -> Result<String>[src]

Queries an option value or section type from UCI. If a key has been changed in the delta, the updated value will be returned.

Allowed keys are like network.wan.proto, network.@interface[-1].iface, network.lan and network.@interface[-1]

if the entry does not exist an Err is returned.

Trait Implementations

impl Drop for Uci[src]

fn drop(&mut self)[src]

Executes the destructor for this type. Read more

Auto Trait Implementations

impl RefUnwindSafe for Uci

impl !Send for Uci

impl !Sync for Uci

impl Unpin for Uci

impl UnwindSafe for Uci

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.