Struct confget::defs::Config[][src]

pub struct Config {
Show fields pub backend: BackendKind, pub filename: Option<String>, pub list_all: bool, pub match_regex: bool, pub match_var_names: bool, pub match_var_values: Option<String>, pub name_prefix: String, pub name_suffix: String, pub section: String, pub section_override: bool, pub section_specified: bool, pub shell_escape: bool, pub show_var_name: bool, pub varnames: Vec<String>,
}
Expand description

Configuration settings for the confget functions.

This is the main way to control the behavior of a backend’s read_file method, the read_ini_file function, and the format::filter_vars function: specify what file to read, what variables to extract from it, and how to format them.

Fields

backend: BackendKind
Expand description

The configuration backend to use.

filename: Option<String>
Expand description

The (backend-specific) filename to read data from.

list_all: bool
Expand description

Formatting: select all the variables in the specified section.

match_regex: bool
Expand description

Formatting: treat the variable match patterns as regular expressions instead of glob ones.

match_var_names: bool
Expand description

Formatting: treat varnames as a list of patterns, not exact variable names.

match_var_values: Option<String>
Expand description

Formatting: only select variables with values that match a pattern.

name_prefix: String
Expand description

Formatting: specify a string to prepend to the variable name.

name_suffix: String
Expand description

Formatting: specify a string to append to the variable name.

section: String
Expand description

Formatting: select variables from the specified section.

section_override: bool
Expand description

Formatting: read variables from the initial section (“”), then override their values with variables from the one specified by the section field.

section_specified: bool
Expand description

Formatting: if section is an empty string and there are no variables in the initial section, do not select the first section defined in the file.

shell_escape: bool
Expand description

Formatting: make the output values suitable for parsing by Bourne-like shells.

show_var_name: bool
Expand description

Formatting: always display the variable name.

varnames: Vec<String>
Expand description

Formatting: select variable names or patterns to display.

Implementations

impl Config[src]

pub fn get_default() -> Self[src]

Initialize a Config object with default values.

This is the recommended way to use the Config struct: only override the settings that must be overridden.

Trait Implementations

impl Debug for Config[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl RefUnwindSafe for Config

impl Send for Config

impl Sync for Config

impl Unpin for Config

impl UnwindSafe for Config

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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.

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

Performs the conversion.

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.

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

Performs the conversion.