[][src]Struct ov_config::ExampleConfig

pub struct ExampleConfig {
    pub c_p_a_t_h: String,
    pub Section: Section,
}

Configuration schema struct.

Basically is a struct of all sections. User will need to use Config.Section.Key to access value.

Fields

c_p_a_t_h: StringSection: Section

Methods

impl ExampleConfig[src]

pub fn verify(&self) -> Result<(), OVConfigError>[src]

Sanity check convenience function

This function will exec the closure on each field with the input of the field's value. Change c_p_a_t_h will change the path that cached inthe configuration object.

pub fn get_config_no_verify<T: AsRef<str> + ?Sized>(
    path: &T
) -> Result<Self, OVConfigError>
[src]

Get configuration without auto verification.

Will use default value if specific field is not found in the configuration file.

Argument:

  • path: Path to the configuration. This path will be cached in the object for refresh and flush.

Return:

Will return configuration object on success.

pub fn get_config<T: AsRef<str> + ?Sized>(
    path: &T
) -> Result<Self, OVConfigError>
[src]

Get configuration with auto verification.

Will use default value if specific field is not found in the configuration file.

Argument:

  • path: Path to the configuration. This path will be cached in the object for refresh and flush.

Return:

Will return configuration object on success.

pub fn refresh(&mut self) -> Result<(), OVConfigError>[src]

Read the configuration file and update current object.

This function will automatically do sanity check on the value.

pub fn refresh_no_verify(&mut self) -> Result<(), OVConfigError>[src]

Read the configuration file and update current object.

This function will NOT automatically do sanity check on the value.

pub fn flush(&self) -> Result<(), OVConfigError>[src]

Flush whatever in configuration object to file.

This function will automatically do sanity check on the value.

pub fn flush_no_verify(&self) -> Result<(), OVConfigError>[src]

Flush whatever in configuration object to file.

This function will automatically do sanity check on the value.

Trait Implementations

impl PartialEq<ExampleConfig> for ExampleConfig[src]

impl Default for ExampleConfig[src]

impl Debug for ExampleConfig[src]

Auto Trait Implementations

Blanket Implementations

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

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

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.

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.

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

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

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