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) -> Style
pub fn from_dotted_str(s: &str) -> Style
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 fn force_styling(self, value: bool) -> Style
pub fn force_styling(self, value: bool) -> Style
Forces styling on or off.
This overrides the automatic detection.
sourcepub fn for_stderr(self) -> Style
pub fn for_stderr(self) -> Style
Specifies that style is applying to something being written on stderr.
sourcepub fn for_stdout(self) -> Style
pub fn for_stdout(self) -> Style
Specifies that style is applying to something being written on stdout.
This is the default behaviour.
pub fn black(self) -> Style
pub fn red(self) -> Style
pub fn green(self) -> Style
pub fn yellow(self) -> Style
pub fn blue(self) -> Style
pub fn magenta(self) -> Style
pub fn cyan(self) -> Style
pub fn white(self) -> Style
pub fn color256(self, color: u8) -> Style
pub fn bright(self) -> Style
pub fn on_black(self) -> Style
pub fn on_red(self) -> Style
pub fn on_green(self) -> Style
pub fn on_yellow(self) -> Style
pub fn on_blue(self) -> Style
pub fn on_magenta(self) -> Style
pub fn on_cyan(self) -> Style
pub fn on_white(self) -> Style
pub fn on_color256(self, color: u8) -> Style
pub fn on_bright(self) -> Style
pub fn bold(self) -> Style
pub fn dim(self) -> Style
pub fn italic(self) -> Style
pub fn underlined(self) -> Style
pub fn blink(self) -> Style
pub fn blink_fast(self) -> Style
pub fn reverse(self) -> Style
pub fn strikethrough(self) -> Style
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)