pub enum AppMode {
Development,
Production,
}Expand description
Controls how the framework behaves at startup and at runtime.
Variants§
Development
Full startup banner, per-request console logging, verbose diagnostics.
Opt-in only (APP_ENV=Development): local development must say so
explicitly.
Production
Minimal one-line startup message, no framework-initiated console logging.
The default: a forgotten APP_ENV keeps the production guards on instead
of silently weakening them.
Implementations§
Source§impl AppMode
impl AppMode
Sourcepub fn overlay_filename(&self) -> &'static str
pub fn overlay_filename(&self) -> &'static str
环境模式对应的 overlay 文件名,如 appsettings.Development.json。
Sourcepub fn from_env() -> AppMode
pub fn from_env() -> AppMode
从环境变量 APP_ENV 解析运行模式;未设置或值非法时返回 Production。
接受(不区分大小写):Production / Prod / Development / Dev。
未设置或值非法时输出一次 tracing::warn!:安全默认值必须显式关掉,
本机开发设置 APP_ENV=Development 即可。
Sourcepub fn from_env_var(var: &str) -> AppMode
pub fn from_env_var(var: &str) -> AppMode
从指定环境变量名解析运行模式。
Trait Implementations§
impl Copy for AppMode
impl Eq for AppMode
impl StructuralPartialEq for AppMode
Auto Trait Implementations§
impl Forget for AppMode
impl Freeze for AppMode
impl Move for AppMode
impl RefUnwindSafe for AppMode
impl Send for AppMode
impl Sync for AppMode
impl Unpin for AppMode
impl UnsafeUnpin for AppMode
impl UnwindSafe for AppMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.