pub struct Style { /* private fields */ }Available on crate feature
color only.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 const fn force_styling(self, value: bool) -> Style
pub const fn force_styling(self, value: bool) -> Style
Forces styling on or off.
This overrides the automatic detection.
Sourcepub const fn for_stderr(self) -> Style
pub const fn for_stderr(self) -> Style
Specifies that style is applying to something being written on stderr.
Sourcepub const fn for_stdout(self) -> Style
pub const fn for_stdout(self) -> Style
Specifies that style is applying to something being written on stdout.
This is the default behaviour.
pub const fn black(self) -> Style
pub const fn red(self) -> Style
pub const fn green(self) -> Style
pub const fn yellow(self) -> Style
pub const fn blue(self) -> Style
pub const fn magenta(self) -> Style
pub const fn cyan(self) -> Style
pub const fn white(self) -> Style
pub const fn color256(self, color: u8) -> Style
pub const fn true_color(self, r: u8, g: u8, b: u8) -> Style
pub const fn bright(self) -> Style
pub const fn on_black(self) -> Style
pub const fn on_red(self) -> Style
pub const fn on_green(self) -> Style
pub const fn on_yellow(self) -> Style
pub const fn on_blue(self) -> Style
pub const fn on_magenta(self) -> Style
pub const fn on_cyan(self) -> Style
pub const fn on_white(self) -> Style
pub const fn on_color256(self, color: u8) -> Style
pub const fn on_true_color(self, r: u8, g: u8, b: u8) -> Style
pub const fn on_bright(self) -> Style
pub const fn bold(self) -> Style
pub const fn dim(self) -> Style
pub const fn italic(self) -> Style
pub const fn underlined(self) -> Style
pub const fn blink(self) -> Style
pub const fn blink_fast(self) -> Style
pub const fn reverse(self) -> Style
pub const fn strikethrough(self) -> Style
Trait Implementations§
Source§impl ArchiveWith<Style> for StyleWith
Available on crate feature rkyv and (crate features color or trace) only.
impl ArchiveWith<Style> for StyleWith
Available on crate feature
rkyv and (crate features color or trace) only.Source§type Archived = ArchivedString
type Archived = ArchivedString
The archived type of
Self with F.Source§type Resolver = StringResolver
type Resolver = StringResolver
The resolver of a
Self with F.Source§impl<D> DeserializeWith<ArchivedString, Style, D> for StyleWith
Available on crate feature rkyv and (crate features color or trace) only.
impl<D> DeserializeWith<ArchivedString, Style, D> for StyleWith
Available on crate feature
rkyv and (crate features color or trace) only.Source§fn deserialize_with(
field: &ArchivedString,
_: &mut D,
) -> Result<Style, D::Error>
fn deserialize_with( field: &ArchivedString, _: &mut D, ) -> Result<Style, D::Error>
Deserializes the field type
F using the given deserializer.impl Eq for Style
Source§impl<S> SerializeWith<Style, S> for StyleWith
Available on crate feature rkyv and (crate features color or trace) only.
impl<S> SerializeWith<Style, S> for StyleWith
Available on crate feature
rkyv and (crate features color or trace) only.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 UnsafeUnpin for Style
impl UnwindSafe for Style
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.