pub struct Style { /* private fields */ }
Expand description
A stored style that can be applied.
Implementations§
Source§impl Style
impl Style
Sourcepub fn from_dotted_str(s: &str) -> Self
pub fn from_dotted_str(s: &str) -> Self
Creates a style from a dotted string.
Effectively the string is split at each dot and then the
terms in between are applied. For instance red.on_blue
will
create a string that is red on blue background. 9.on_12
is
the same, but using 256 color numbers. Unknown terms are
ignored.
Sourcepub fn apply_to<D>(&self, val: D) -> StyledObject<D>
pub fn apply_to<D>(&self, val: D) -> StyledObject<D>
Apply the style to something that can be displayed.
Sourcepub const fn force_styling(self, value: bool) -> Self
pub const fn force_styling(self, value: bool) -> Self
Forces styling on or off.
This overrides the automatic detection.
Sourcepub const fn for_stderr(self) -> Self
pub const fn for_stderr(self) -> Self
Specifies that style is applying to something being written on stderr.
Sourcepub const fn for_stdout(self) -> Self
pub const fn for_stdout(self) -> Self
Specifies that style is applying to something being written on stdout.
This is the default behaviour.
pub const fn black(self) -> Self
pub const fn red(self) -> Self
pub const fn green(self) -> Self
pub const fn yellow(self) -> Self
pub const fn blue(self) -> Self
pub const fn magenta(self) -> Self
pub const fn cyan(self) -> Self
pub const fn white(self) -> Self
pub const fn color256(self, color: u8) -> Self
pub const fn bright(self) -> Self
pub const fn on_black(self) -> Self
pub const fn on_red(self) -> Self
pub const fn on_green(self) -> Self
pub const fn on_yellow(self) -> Self
pub const fn on_blue(self) -> Self
pub const fn on_magenta(self) -> Self
pub const fn on_cyan(self) -> Self
pub const fn on_white(self) -> Self
pub const fn on_color256(self, color: u8) -> Self
pub const fn on_bright(self) -> Self
pub fn bold(self) -> Self
pub fn dim(self) -> Self
pub fn italic(self) -> Self
pub fn underlined(self) -> Self
pub fn blink(self) -> Self
pub fn blink_fast(self) -> Self
pub fn reverse(self) -> Self
pub fn strikethrough(self) -> Self
Trait Implementations§
impl Eq for Style
impl StructuralPartialEq for Style
Auto Trait Implementations§
impl Freeze for Style
impl RefUnwindSafe for Style
impl Send for Style
impl Sync for Style
impl Unpin 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