Struct colored::control::ShouldColorize
source · pub struct ShouldColorize { /* private fields */ }
Expand description
A flag for whether coloring should occur.
Implementations§
source§impl ShouldColorize
impl ShouldColorize
sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Reads environment variables and checks if output is a tty to determine
whether colorization should be used or not.
CLICOLOR_FORCE
takes highest priority, followed by NO_COLOR
,
followed by CLICOLOR
combined with tty check.
sourcepub fn should_colorize(&self) -> bool
pub fn should_colorize(&self) -> bool
Returns if the current coloring is expected.
sourcepub fn set_override(&self, override_colorize: bool)
pub fn set_override(&self, override_colorize: bool)
Use this to force colored to ignore the environment and always/never colorize
sourcepub fn unset_override(&self)
pub fn unset_override(&self)
Remove the manual override and let the environment decide if it’s ok to colorize
Trait Implementations§
source§impl Default for ShouldColorize
impl Default for ShouldColorize
source§fn default() -> ShouldColorize
fn default() -> ShouldColorize
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !Freeze for ShouldColorize
impl RefUnwindSafe for ShouldColorize
impl Send for ShouldColorize
impl Sync for ShouldColorize
impl Unpin for ShouldColorize
impl UnwindSafe for ShouldColorize
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