Struct Configuration

Source
pub struct Configuration {}

Implementations§

Source§

impl Configuration

Source

pub fn get<'a>( &self, _name: &str, default_value: Option<&'a str>, ) -> Option<&'a str>

Get the value of the name property, None if no such property exists. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not None.

Values are processed for [variable expansion] before being returned.

As a side effect get loads the properties from the sources if called for the first time as a lazy init.

Source

pub fn get_trimmed<'a>(&self, name: &str) -> Option<&'a str>

Get the value of the name property as a trimmed &str, None if no such property exists. If the key is deprecated, it returns the value of the first key which replaces the deprecated key and is not None

Values are processed for [variable expansion] before being returned.

Source

pub fn get_trimmed_with_default<'a>( &self, name: &str, default_value: &'a str, ) -> &'a str

Get the value of the name property as a trimmed &str, default_value if no such property exists. See Configuration::get_trimmed for more details.

Source

pub fn get_int(&self, name: &str, default_value: i32) -> Result<i32>

Get the value of the name property as an i32. If no such property exists, the provided default value is returned, or if the specified value is not a valid i32, then an error is thrown.

Source

pub fn get_long(&self, name: &str, default_value: i64) -> Result<i64>

Get the value of the name property as an i64. If no such property exists, the provided default value is returned, or if the specified value is not a valid i64, then an error is thrown.

Source

pub fn get_bool(&self, name: &str, default_value: bool) -> bool

Get the value of the name property as a bool. If no such property is specified, or if the specified value is not a valid bool, then default_value is returned.

Trait Implementations§

Source§

impl Clone for Configuration

Source§

fn clone(&self) -> Configuration

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Configuration

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.