pub struct Palette { /* private fields */ }Expand description
Whether colour is on, and the vocabulary for painting with it.
Copy, so it threads through the command tree as a value rather than a
borrow — it is one bool.
Implementations§
Source§impl Palette
impl Palette
Sourcepub const fn plain() -> Self
pub const fn plain() -> Self
A palette that colours nothing.
What every test renders against, and therefore what pins the plain output byte-for-byte: with colour off every method here returns its argument unchanged.
Sourcepub fn resolve(
choice: ColorChoice,
is_terminal: bool,
no_color: Option<&str>,
) -> Self
pub fn resolve( choice: ColorChoice, is_terminal: bool, no_color: Option<&str>, ) -> Self
The palette a run of the CLI gets, from the flag, the stream and the environment.
Pure in all three, so the precedence documented at the top of this module is testable without a terminal or a process environment.
Sourcepub fn ok(self, text: &str) -> String
pub fn ok(self, text: &str) -> String
Something that worked, or a state an operator wants to see.
Sourcepub fn warn(self, text: &str) -> String
pub fn warn(self, text: &str) -> String
Advisory: nothing failed, but read this line.
The advisory outcome of the logging convention, applied to output.
Sourcepub fn unknown(self, text: &str) -> String
pub fn unknown(self, text: &str) -> String
Undecided — a question that was asked and not answered.
Sourcepub fn status(self, text: &str) -> String
pub fn status(self, text: &str) -> String
A status word, by what it means rather than by which table it came from.
One vocabulary covers accounts, orders, authorizations, challenges, EAB credentials, admin users, sessions and TOTP state: the words do not collide in meaning across those domains, and an operator scanning a column is asking the same question of all of them.
An unrecognised word renders plain. A status this build has never
heard of is exactly the case where a guessed colour would mislead — and
AuditEntry::event deliberately comes back as the string it was stored
as, so an older binary reading a newer database gets here.
off counts as bad on purpose: the only place it appears is an
operator’s second factor, and admin.require_mfa exists because that is
a state somebody wants to notice in a listing.
Trait Implementations§
impl Copy for Palette
impl Eq for Palette
impl StructuralPartialEq for Palette
Auto Trait Implementations§
impl Freeze for Palette
impl RefUnwindSafe for Palette
impl Send for Palette
impl Sync for Palette
impl Unpin for Palette
impl UnsafeUnpin for Palette
impl UnwindSafe for Palette
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more