pub enum Attr {
Show 20 variants
String(String),
Bool(bool),
I8(i8),
U8(u8),
I8Array(Vec<i8>),
U8Array(Vec<u8>),
I16(i16),
U16(u16),
I16Array(Vec<i16>),
U16Array(Vec<u16>),
I32(i32),
U32(u32),
I32Array(Vec<i32>),
U32Array(Vec<u32>),
I64(i64),
U64(u64),
I64Array(Vec<i64>),
U64Array(Vec<u64>),
Type(Type),
TypeArray(Vec<Type>),
}
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts this type into the (usually inferred) input type.
Converts this type into the (usually inferred) input type.
Converts this type into the (usually inferred) input type.
This method tests for self
and other
values to be equal, and is used
by ==
.
This method tests for !=
. The default implementation is almost always
sufficient, and should not be overridden without very good reason.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
🔬This is a nightly-only experimental API. (clone_to_uninit
)
Performs copy-assignment from
self
to
dst
.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
Returns a styled value derived from self
with the foreground set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red()
and
green()
, which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg()
:
use yansi::{Paint, Color};
painted.fg(Color::White);
Set foreground color to white using white()
.
use yansi::Paint;
painted.white();
Returns self
with the
fg()
set to
[Color::Primary
].
§Example
println!("{}", value.primary());
Returns self
with the
fg()
set to
[Color::Fixed
].
§Example
println!("{}", value.fixed(color));
Returns self
with the
fg()
set to
[Color::Rgb
].
§Example
println!("{}", value.rgb(r, g, b));
Returns self
with the
fg()
set to
[Color::Black
].
§Example
println!("{}", value.black());
Returns self
with the
fg()
set to
[Color::Red
].
§Example
println!("{}", value.red());
Returns self
with the
fg()
set to
[Color::Green
].
§Example
println!("{}", value.green());
Returns self
with the
fg()
set to
[Color::Yellow
].
§Example
println!("{}", value.yellow());
Returns self
with the
fg()
set to
[Color::Blue
].
§Example
println!("{}", value.blue());
Returns self
with the
fg()
set to
[Color::Magenta
].
§Example
println!("{}", value.magenta());
Returns self
with the
fg()
set to
[Color::Cyan
].
§Example
println!("{}", value.cyan());
Returns self
with the
fg()
set to
[Color::White
].
§Example
println!("{}", value.white());
Returns self
with the
fg()
set to
[Color::BrightBlack
].
§Example
println!("{}", value.bright_black());
Returns self
with the
fg()
set to
[Color::BrightRed
].
§Example
println!("{}", value.bright_red());
Returns self
with the
fg()
set to
[Color::BrightGreen
].
§Example
println!("{}", value.bright_green());
Returns self
with the
fg()
set to
[Color::BrightYellow
].
§Example
println!("{}", value.bright_yellow());
Returns self
with the
fg()
set to
[Color::BrightBlue
].
§Example
println!("{}", value.bright_blue());
Returns self
with the
fg()
set to
[Color::BrightMagenta
].
§Example
println!("{}", value.bright_magenta());
Returns self
with the
fg()
set to
[Color::BrightCyan
].
§Example
println!("{}", value.bright_cyan());
Returns self
with the
fg()
set to
[Color::BrightWhite
].
§Example
println!("{}", value.bright_white());
Returns a styled value derived from self
with the background set to
value
.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red()
and
on_green()
, which have the same functionality but
are pithier.
§Example
Set background color to red using fg()
:
use yansi::{Paint, Color};
painted.bg(Color::Red);
Set background color to red using on_red()
.
use yansi::Paint;
painted.on_red();
Returns self
with the
bg()
set to
[Color::Primary
].
§Example
println!("{}", value.on_primary());
Returns self
with the
bg()
set to
[Color::Fixed
].
§Example
println!("{}", value.on_fixed(color));
Returns self
with the
bg()
set to
[Color::Rgb
].
§Example
println!("{}", value.on_rgb(r, g, b));
Returns self
with the
bg()
set to
[Color::Black
].
§Example
println!("{}", value.on_black());
Returns self
with the
bg()
set to
[Color::Red
].
§Example
println!("{}", value.on_red());
Returns self
with the
bg()
set to
[Color::Green
].
§Example
println!("{}", value.on_green());
Returns self
with the
bg()
set to
[Color::Yellow
].
§Example
println!("{}", value.on_yellow());
Returns self
with the
bg()
set to
[Color::Blue
].
§Example
println!("{}", value.on_blue());
Returns self
with the
bg()
set to
[Color::Magenta
].
§Example
println!("{}", value.on_magenta());
Returns self
with the
bg()
set to
[Color::Cyan
].
§Example
println!("{}", value.on_cyan());
Returns self
with the
bg()
set to
[Color::White
].
§Example
println!("{}", value.on_white());
Returns self
with the
bg()
set to
[Color::BrightBlack
].
§Example
println!("{}", value.on_bright_black());
Returns self
with the
bg()
set to
[Color::BrightRed
].
§Example
println!("{}", value.on_bright_red());
Returns self
with the
bg()
set to
[Color::BrightGreen
].
§Example
println!("{}", value.on_bright_green());
Returns self
with the
bg()
set to
[Color::BrightYellow
].
§Example
println!("{}", value.on_bright_yellow());
Returns self
with the
bg()
set to
[Color::BrightBlue
].
§Example
println!("{}", value.on_bright_blue());
Returns self
with the
bg()
set to
[Color::BrightMagenta
].
§Example
println!("{}", value.on_bright_magenta());
Returns self
with the
bg()
set to
[Color::BrightCyan
].
§Example
println!("{}", value.on_bright_cyan());
Returns self
with the
bg()
set to
[Color::BrightWhite
].
§Example
println!("{}", value.on_bright_white());
Enables the styling [Attribute
] value
.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold()
and
underline()
, which have the same functionality
but are pithier.
§Example
Make text bold using attr()
:
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);
Make text bold using using bold()
.
use yansi::Paint;
painted.bold();
Returns self
with the
attr()
set to
[Attribute::Bold
].
§Example
println!("{}", value.bold());
Returns self
with the
attr()
set to
[Attribute::Dim
].
§Example
println!("{}", value.dim());
Returns self
with the
attr()
set to
[Attribute::Italic
].
§Example
println!("{}", value.italic());
Returns self
with the
attr()
set to
[Attribute::Underline
].
§Example
println!("{}", value.underline());
Returns self
with the
attr()
set to
[Attribute::Blink
].
§Example
println!("{}", value.blink());
Returns self
with the
attr()
set to
[Attribute::RapidBlink
].
§Example
println!("{}", value.rapid_blink());
Returns self
with the
attr()
set to
[Attribute::Invert
].
§Example
println!("{}", value.invert());
Returns self
with the
attr()
set to
[Attribute::Conceal
].
§Example
println!("{}", value.conceal());
Returns self
with the
attr()
set to
[Attribute::Strike
].
§Example
println!("{}", value.strike());
Enables the yansi
[Quirk
] value
.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask()
and
wrap()
, which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk()
:
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);
Enable wrapping using wrap()
.
use yansi::Paint;
painted.wrap();
Returns self
with the
quirk()
set to
[Quirk::Mask
].
§Example
println!("{}", value.mask());
Returns self
with the
quirk()
set to
[Quirk::Wrap
].
§Example
println!("{}", value.wrap());
Returns self
with the
quirk()
set to
[Quirk::Linger
].
§Example
println!("{}", value.linger());
👎Deprecated since 1.0.1: renamed to resetting()
due to conflicts with Vec::clear()
.
The clear()
method will be removed in a future release.
Returns self
with the
quirk()
set to
[Quirk::Clear
].
§Example
println!("{}", value.clear());
Returns self
with the
quirk()
set to
[Quirk::Resetting
].
§Example
println!("{}", value.resetting());
Returns self
with the
quirk()
set to
[Quirk::Bright
].
§Example
println!("{}", value.bright());
Returns self
with the
quirk()
set to
[Quirk::OnBright
].
§Example
println!("{}", value.on_bright());
Conditionally enable styling based on whether the [Condition
] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted
only when both stdout
and stderr
are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);
Create a new [
Painted
] with a default [
Style
].
Read more
Apply a style wholesale to
self
. Any previous style is replaced.
Read more
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.