pub struct Style { /* private fields */ }Expand description
Whether styled output is wanted, and the sequences for it.
Construct with Style::for_stderr at the point of use rather than
caching one: the decision is cheap, and a cached one taken before a
stream was redirected would be wrong.
Implementations§
Source§impl Style
impl Style
Sourcepub fn for_stderr() -> Self
pub fn for_stderr() -> Self
The style for diagnostics: colour only when stderr is a terminal.
Sourcepub fn for_stdout() -> Self
pub fn for_stdout() -> Self
The style for help text, which is printed to stdout when it was asked for and to stderr when it is a refusal.
Sourcepub fn is_painted(self) -> bool
pub fn is_painted(self) -> bool
Whether anything this style produces will differ from plain text.
Read by callers whose whole output is decoration: a summary that nobody is looking at is not worth the two lines it would push a real error off the top of the screen with.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin for Style
impl UnsafeUnpin for Style
impl UnwindSafe for Style
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