[−][src]Enum rocket::config::Environment
pub enum Environment { Development, Staging, Production, }
An enum corresponding to the valid configuration environments.
Variants
Development
The development environment.
Staging
The staging environment.
Production
The production environment.
Methods
impl Environment
[src]
impl Environment
pub fn is_dev(self) -> bool
[src]
pub fn is_dev(self) -> bool
Returns true
if self
is Environment::Development
.
Example
use rocket::config::Environment; assert!(Environment::Development.is_dev()); assert!(!Environment::Production.is_dev());
pub fn is_stage(self) -> bool
[src]
pub fn is_stage(self) -> bool
Returns true
if self
is Environment::Staging
.
Example
use rocket::config::Environment; assert!(Environment::Staging.is_stage()); assert!(!Environment::Production.is_stage());
pub fn is_prod(self) -> bool
[src]
pub fn is_prod(self) -> bool
Returns true
if self
is Environment::Production
.
Example
use rocket::config::Environment; assert!(Environment::Production.is_prod()); assert!(!Environment::Staging.is_prod());
impl Environment
[src]
impl Environment
pub fn active() -> Result<Environment, ConfigError>
[src]
pub fn active() -> Result<Environment, ConfigError>
Retrieves the "active" environment as determined by the ROCKET_ENV
environment variable. If ROCKET_ENV
is not set, returns Development
.
Errors
Returns a BadEnv
ConfigError
if ROCKET_ENV
contains an invalid
environment name.
Trait Implementations
impl Hash for Environment
[src]
impl Hash for Environment
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl PartialEq for Environment
[src]
impl PartialEq for Environment
fn eq(&self, other: &Environment) -> bool
[src]
fn eq(&self, other: &Environment) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl Eq for Environment
[src]
impl Eq for Environment
impl Debug for Environment
[src]
impl Debug for Environment
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Clone for Environment
[src]
impl Clone for Environment
fn clone(&self) -> Environment
[src]
fn clone(&self) -> Environment
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Copy for Environment
[src]
impl Copy for Environment
impl FromStr for Environment
[src]
impl FromStr for Environment
type Err = ()
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Self, Self::Err>
[src]
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a configuration environment from a string. Should be used
indirectly via str
's parse
method.
Examples
Parsing a development environment:
use rocket::config::Environment; let env = "development".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Development); let env = "dev".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Development); let env = "devel".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Development);
Parsing a staging environment:
use rocket::config::Environment; let env = "staging".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Staging); let env = "stage".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Staging);
Parsing a production environment:
use rocket::config::Environment; let env = "production".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Production); let env = "prod".parse::<Environment>(); assert_eq!(env.unwrap(), Environment::Production);
impl Display for Environment
[src]
impl Display for Environment
Auto Trait Implementations
impl Send for Environment
impl Send for Environment
impl Sync for Environment
impl Sync for Environment
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
type Owned = T
fn to_owned(&self) -> T
[src]
fn to_owned(&self) -> T
Creates owned data from borrowed data, usually by cloning. Read more
fn clone_into(&self, target: &mut T)
[src]
fn clone_into(&self, target: &mut T)
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
impl<T> ToString for T where
T: Display + ?Sized,
[src]
impl<T> ToString for T where
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow(&self) -> &T
[src]
fn borrow(&self) -> &T
Immutably borrows from an owned value. Read more
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
ⓘImportant traits for &'a mut Wfn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Typeable for T where
T: Any,
[src]
impl<T> Typeable for T where
T: Any,