use crate::context::{ContextBuilder, ContextMarker};
use crate::environment::Environment;
use crate::types::EnvType;
pub struct IsDebugContext;
impl ContextMarker for IsDebugContext {
type Value = bool;
}
pub fn debug_context() -> ContextBuilder<IsDebugContext> {
ContextBuilder::<IsDebugContext>::default()
.with_value(EnvType::Dev, true)
.with_default(false)
}
pub trait IsDebug {
fn is_debug(&self) -> bool;
}
impl IsDebug for Environment {
fn is_debug(&self) -> bool {
self.current_value::<IsDebugContext>().unwrap_or(false)
}
}