pub enum Environment {
    Local,
    Test,
    Development,
    Production,
}
Expand description

Application environment. Affect configuration file loaded by load_config.

Any format listed in config::FileFormat can be used.

Variants

Local

Local environment. Will use config/local.[FORMAT].

Test

Test environment. Will use config/test.[FORMAT].

Development

Development environment. Will use config/development.[FORMAT].

Production

Production environment. Will use config/production.[FORMAT].

Implementations

Load environment from default env APP_ENVIRONMENT. Return Result of Environment. If env APP_ENVIRONMENT is not set, return Ok(Environment::default()).

Example
let environment = Environment::from_env().unwrap();

Load environment from given env. Return Result of Environment. If env APP_ENVIRONMENT is not set, return Ok(Environment::default()).

Example
let environment = Environment::from_custom_env("CUSTOM_ENVIRONMENT").unwrap();

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Formats the value using the given formatter. Read more

The associated error which can be returned from parsing.

Parses a string s to return a value of this type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

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.

Should always be Self

Converts the given value to a String. 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.