Struct settings::Domain

source ·
pub struct Domain {
    pub(crate) inner: Tree,
    pub(crate) domain: String,
}
Expand description

The settings domain. This object allows keeping track of the encapsulation of the settings parameters and also to keep separated the different operations on different domains

For example, the network module will only be interested about the network settings.

Fields§

§inner: Tree§domain: String

Implementations§

source§

impl Domain

source

pub(crate) fn new<S>(inner: Tree, domain: S) -> Selfwhere S: Into<String>,

source

pub(crate) fn key<K>(&self, key: K) -> Stringwhere K: Display,

source

pub fn domain(&self) -> &str

Get the domain full name

source

pub fn sub_domain<S>(&self, domain: S) -> Selfwhere S: AsRef<str>,

create a subdomain off the given domain

panics

This function will panic if the given domain is empty

source

pub fn get<K>(&self, key: K) -> Result<Option<String>, Error>where K: Display,

get the value associated to the given key (if any) within the current Domain.

source

pub fn insert<K, V>(&self, key: K, value: V) -> Result<Option<String>, Error>where K: Display, V: AsRef<str>,

insert a new key/value or replace the existing one with the new value.

If it was a replace, the previous value is returned. Otherwise new value will return None.

source

pub fn subscribe(&self) -> Subscriber

subscribe to changes in this domain

any changes in this domain or any of its subdomain will raise an Event.

Trait Implementations§

source§

impl Clone for Domain

source§

fn clone(&self) -> Domain

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Domain

§

impl Send for Domain

§

impl Sync for Domain

§

impl Unpin for Domain

§

impl !UnwindSafe for Domain

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.