pub struct Environment { /* private fields */ }Expand description
The deployment a panel runs in, such as staging: every page of the panel, its sign-in pages included, carries a stripe and a badge in its color, and its browser tab title starts with its name.
let panel = Panel::new("admin");
let panel = match std::env::var("APP_ENV").as_deref() {
Ok("production") => panel,
Ok(name) => panel.environment(Environment::new(name.to_owned()).color(Color::Info)),
Err(_) => panel.environment(Environment::new("Local")),
};Implementations§
Source§impl Environment
impl Environment
Sourcepub fn new(name: impl Into<Text>) -> Environment
pub fn new(name: impl Into<Text>) -> Environment
An environment named name, in Color::Warning.
Sourcepub fn color(self, color: Color) -> Environment
pub fn color(self, color: Color) -> Environment
Paint the stripe and the badge in color.
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 moreAuto 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