Struct mhost::app::output::styles::OK

source ·
pub struct OK { /* private fields */ }

Methods from Deref<Target = Style>§

source

pub fn fg_color(&self) -> Color

Returns the foreground color of self.

use yansi::{Style, Color};

let plain = Style::default();
assert_eq!(plain.fg_color(), Color::Unset);

let red = plain.fg(Color::Red);
assert_eq!(red.fg_color(), Color::Red);
source

pub fn bg_color(&self) -> Color

Returns the foreground color of self.

use yansi::{Style, Color};

let plain = Style::default();
assert_eq!(plain.bg_color(), Color::Unset);

let white = plain.bg(Color::White);
assert_eq!(white.bg_color(), Color::White);
source

pub fn is_masked(&self) -> bool

Returns true if self is masked.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_masked());

let masked = plain.mask();
assert!(masked.is_masked());
source

pub fn is_wrapping(&self) -> bool

Returns true if self is wrapping.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_wrapping());

let wrapping = plain.wrap();
assert!(wrapping.is_wrapping());
source

pub fn is_bold(&self) -> bool

Returns true if the bold property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_bold());

let styled = plain.bold();
assert!(styled.is_bold());
source

pub fn is_dimmed(&self) -> bool

Returns true if the dimmed property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_dimmed());

let styled = plain.dimmed();
assert!(styled.is_dimmed());
source

pub fn is_italic(&self) -> bool

Returns true if the italic property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_italic());

let styled = plain.italic();
assert!(styled.is_italic());
source

pub fn is_underline(&self) -> bool

Returns true if the underline property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_underline());

let styled = plain.underline();
assert!(styled.is_underline());

Returns true if the blink property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_blink());

let styled = plain.blink();
assert!(styled.is_blink());
source

pub fn is_invert(&self) -> bool

Returns true if the invert property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_invert());

let styled = plain.invert();
assert!(styled.is_invert());
source

pub fn is_hidden(&self) -> bool

Returns true if the hidden property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_hidden());

let styled = plain.hidden();
assert!(styled.is_hidden());
source

pub fn is_strikethrough(&self) -> bool

Returns true if the strikethrough property is set on self.

use yansi::Style;

let plain = Style::default();
assert!(!plain.is_strikethrough());

let styled = plain.strikethrough();
assert!(styled.is_strikethrough());
source

pub fn fmt_prefix(&self, f: &mut dyn Write) -> Result<(), Error>

Writes the ANSI code prefix for the currently set styles.

This method is intended to be used inside of fmt::Display and fmt::Debug implementations for custom or specialized use-cases. Most users should use Paint for all painting needs.

This method writes the ANSI code prefix irrespective of whether painting is currently enabled or disabled. To write the prefix only if painting is enabled, condition a call to this method on Paint::is_enabled().

§Example
use std::fmt;
use yansi::Style;

struct CustomItem {
    item: u32,
    style: Style
}

impl fmt::Display for CustomItem {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.style.fmt_prefix(f)?;
        write!(f, "number: {}", self.item)?;
        self.style.fmt_suffix(f)
    }
}
source

pub fn fmt_suffix(&self, f: &mut dyn Write) -> Result<(), Error>

Writes the ANSI code suffix for the currently set styles.

This method is intended to be used inside of fmt::Display and fmt::Debug implementations for custom or specialized use-cases. Most users should use Paint for all painting needs.

This method writes the ANSI code suffix irrespective of whether painting is currently enabled or disabled. To write the suffix only if painting is enabled, condition a call to this method on Paint::is_enabled().

§Example
use std::fmt;
use yansi::Style;

struct CustomItem {
    item: u32,
    style: Style
}

impl fmt::Display for CustomItem {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        self.style.fmt_prefix(f)?;
        write!(f, "number: {}", self.item)?;
        self.style.fmt_suffix(f)
    }
}

Trait Implementations§

source§

impl Deref for OK

§

type Target = Style

The resulting type after dereferencing.
source§

fn deref(&self) -> &Style

Dereferences the value.
source§

impl LazyStatic for OK

Auto Trait Implementations§

§

impl RefUnwindSafe for OK

§

impl Send for OK

§

impl Sync for OK

§

impl Unpin for OK

§

impl UnwindSafe for OK

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more