pub enum Environment {
Dev,
Test,
Prod,
Custom(String),
}Expand description
Runtime environment for a Serenade application.
Well-known values are Self::Dev, Self::Test, and Self::Prod.
Any other non-empty name becomes Self::Custom (for example staging or
recette), matching Symfony’s free-form APP_ENV habit.
Variants§
Dev
Local development.
Test
Automated tests.
Prod
Production.
Custom(String)
Application-defined environment (staging, recette, …).
Implementations§
Source§impl Environment
impl Environment
Sourcepub const fn is_debug(&self) -> bool
pub const fn is_debug(&self) -> bool
Returns whether this environment enables debug by default.
Only Self::Dev and Self::Test are debug. Self::Prod and
Self::Custom are not; override with crate::Kernel::with_debug.
Sourcepub fn from_name(name: &str) -> Result<Self, KernelError>
pub fn from_name(name: &str) -> Result<Self, KernelError>
Parses an environment name (ASCII case-insensitive).
dev, test, and prod map to the well-known variants. Any other
non-empty name becomes Self::Custom with a lowercase value.
§Errors
Returns KernelError::UnknownEnvironment when name is empty after trim.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Environment
impl Debug for Environment
Source§impl<'de> Deserialize<'de> for Environment
impl<'de> Deserialize<'de> for Environment
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for Environment
impl Display for Environment
impl Eq for Environment
Source§impl From<Environment> for String
impl From<Environment> for String
Source§fn from(value: Environment) -> Self
fn from(value: Environment) -> Self
Converts to this type from the input type.
Source§impl FromStr for Environment
impl FromStr for Environment
Source§impl Hash for Environment
impl Hash for Environment
Source§impl PartialEq for Environment
impl PartialEq for Environment
Source§fn eq(&self, other: &Environment) -> bool
fn eq(&self, other: &Environment) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for Environment
impl Serialize for Environment
impl StructuralPartialEq for Environment
Auto Trait Implementations§
impl Freeze for Environment
impl RefUnwindSafe for Environment
impl Send for Environment
impl Sync for Environment
impl Unpin for Environment
impl UnsafeUnpin for Environment
impl UnwindSafe for Environment
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more