Enum ezconf::source::Source

source ·
pub enum Source<'a> {
    File(&'a str),
    Memory(&'a str),
}
Expand description

Configuration Sources

To be used when initializing a config.

Example

static CONFIG: ezconf::Config = ezconf::INIT;

fn main() {
    CONFIG.init([
        // Try a config in the current directory
        ezconf::Source::File("config.toml"),
        // Then try some standard paths
        ezconf::Source::File("~/.config.toml"),
        ezconf::Source::File("~/.config/config.toml"),
        ezconf::Source::File("/etc/config.toml"),
        // Finally resort to a default config embedded in the program
        ezconf::Source::Memory(include_str!("default.toml")),
    ].iter()).unwrap();
}

Variants§

§

File(&'a str)

A config file

§

Memory(&'a str)

An in-memory config file

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.