pub struct Section<'a> { /* private fields */ }Expand description
Represents a configuration section.
Implementations§
Source§impl<'a> Section<'a>
impl<'a> Section<'a>
Sourcepub fn section(&self, key: &str) -> Section<'a>
pub fn section(&self, key: &str) -> Section<'a>
Gets a configuration subsection in this section.
§Arguments
key- The case-insensitive key of the configuration subsection to get
Sourcepub fn sections(&self) -> Vec<Section<'a>>
pub fn sections(&self) -> Vec<Section<'a>>
Gets all of the subsections in this section.
Sourcepub fn to_owned(&self) -> OwnedSection
pub fn to_owned(&self) -> OwnedSection
Gets an owned copy of the section.
§Remarks
This function is useful for taking ownership of a section in order to decouple it from the entire configuration that created it. The owned section holds a reference to the subset of key/value pairs at this point in the configuration.
Trait Implementations§
Source§impl Binder for Section<'_>
Available on crate feature binder only.
impl Binder for Section<'_>
Available on crate feature
binder only.Source§fn reify<T: DeserializeOwned>(&self) -> Result<T>
fn reify<T: DeserializeOwned>(&self) -> Result<T>
Creates and returns a structure reified from the configuration.
Source§fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
fn bind<T: DeserializeOwned>(&self, instance: &mut T) -> Result
Binds the configuration to the specified instance. Read more
Source§fn bind_at<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
) -> Result
fn bind_at<T: DeserializeOwned>( &self, key: impl AsRef<str>, instance: &mut T, ) -> Result
Binds the specified configuration section to the provided instance. Read more
Source§fn get_value<T: FromStr>(
&self,
key: impl AsRef<str>,
) -> Result<Option<T>, T::Err>
fn get_value<T: FromStr>( &self, key: impl AsRef<str>, ) -> Result<Option<T>, T::Err>
Gets a typed value from the configuration. Read more
Source§fn get_value_or_default<T: FromStr + Default>(
&self,
key: impl AsRef<str>,
) -> Result<T, T::Err>
fn get_value_or_default<T: FromStr + Default>( &self, key: impl AsRef<str>, ) -> Result<T, T::Err>
Gets an optional, typed value from the configuration. Read more
Source§fn reify_unchecked<T: DeserializeOwned>(&self) -> T
fn reify_unchecked<T: DeserializeOwned>(&self) -> T
Creates and returns a structure reified from the configuration. Read more
Source§fn bind_unchecked<T: DeserializeOwned>(&self, instance: &mut T)
fn bind_unchecked<T: DeserializeOwned>(&self, instance: &mut T)
Binds the configuration to the specified instance. Read more
Source§fn bind_at_unchecked<T: DeserializeOwned>(
&self,
key: impl AsRef<str>,
instance: &mut T,
)
fn bind_at_unchecked<T: DeserializeOwned>( &self, key: impl AsRef<str>, instance: &mut T, )
Binds the specified configuration section to the provided instance. Read more
Source§impl Reloadable for Section<'_>
impl Reloadable for Section<'_>
Source§fn can_reload(&self) -> bool
fn can_reload(&self) -> bool
Gets a value indicating whether the configuration can be reloaded.
Source§fn reload_token(&self) -> impl ChangeToken + 'static
fn reload_token(&self) -> impl ChangeToken + 'static
Gets a change token that will be notified when the configuration is reloaded.
Auto Trait Implementations§
impl<'a> Freeze for Section<'a>
impl<'a> !RefUnwindSafe for Section<'a>
impl<'a> Send for Section<'a>
impl<'a> Sync for Section<'a>
impl<'a> Unpin for Section<'a>
impl<'a> UnsafeUnpin for Section<'a>
impl<'a> !UnwindSafe for Section<'a>
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