Enum avantis_utils::config::Environment
source · [−]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
sourceimpl Environment
impl Environment
sourcepub fn from_env() -> Result<Self>
pub fn from_env() -> Result<Self>
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();sourcepub fn from_custom_env(key: &str) -> Result<Self>
pub fn from_custom_env(key: &str) -> Result<Self>
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
sourceimpl Debug for Environment
impl Debug for Environment
sourceimpl Default for Environment
impl Default for Environment
sourceimpl Display for Environment
impl Display for Environment
sourceimpl FromStr for Environment
impl FromStr for Environment
type Err = ParseError
type Err = ParseError
The associated error which can be returned from parsing.
sourceimpl PartialEq<Environment> for Environment
impl PartialEq<Environment> for Environment
sourceimpl TryFrom<&'_ str> for Environment
impl TryFrom<&'_ str> for Environment
type Error = ParseError
type Error = ParseError
The type returned in the event of a conversion error.
impl StructuralPartialEq for Environment
Auto Trait Implementations
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnwindSafe for Environment
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more