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
impl Domain
pub(crate) fn new<S>(inner: Tree, domain: S) -> Selfwhere S: Into<String>,
pub(crate) fn key<K>(&self, key: K) -> Stringwhere K: Display,
sourcepub fn sub_domain<S>(&self, domain: S) -> Selfwhere
S: AsRef<str>,
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
sourcepub fn get<K>(&self, key: K) -> Result<Option<String>, Error>where
K: Display,
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.
sourcepub fn insert<K, V>(&self, key: K, value: V) -> Result<Option<String>, Error>where
K: Display,
V: AsRef<str>,
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
.
sourcepub fn subscribe(&self) -> Subscriber ⓘ
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§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more