Struct confget::defs::Config

source ·
pub struct Config {
Show 15 fields pub backend: BackendKind, pub encoding: String, 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

The configuration backend to use.

§encoding: String

The encoding the input file is in, or “” for the locale default.

§filename: Option<String>

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

§list_all: bool

Formatting: select all the variables in the specified section.

§match_regex: bool

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

§match_var_names: bool

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

§match_var_values: Option<String>

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

§name_prefix: String

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

§name_suffix: String

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

§section: String

Formatting: select variables from the specified section.

§section_override: bool

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

§section_specified: bool

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

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

§show_var_name: bool

Formatting: always display the variable name.

§varnames: Vec<String>

Formatting: select variable names or patterns to display.

Trait Implementations§

source§

impl Debug for Config

source§

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

Formats the value using the given formatter. Read more
source§

impl Default for Config

source§

fn default() -> Self

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.

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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

§

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.