pub struct MultiInput<M: Display> { /* private fields */ }
Expand description
MultiInput
struct
§Examples
use may_clack::{cancel, multi_input};
let answers = multi_input("message")
.validate(|x| {
if x.is_ascii() {
Ok(())
} else {
Err(Cow::Borrowed("only use ascii characters"))
}
})
.cancel(do_cancel)
.interact()?;
println!("answers {:?}", answers);
fn do_cancel() {
cancel!("operation cancelled");
std::process::exit(1);
}
Implementations§
Source§impl<M: Display> MultiInput<M>
impl<M: Display> MultiInput<M>
Sourcepub fn new(message: M) -> Self
pub fn new(message: M) -> Self
Creates a new MultiInput
struct.
Has a shorthand version in multi_input()
§Examples
use may_clack::{multi_input, multi_input::MultiInput};
// these two are equivalent
let question = MultiInput::new("message");
let question = multi_input("message");
Sourcepub fn initial_value<S: ToString>(&mut self, initial_value: S) -> &mut Self
pub fn initial_value<S: ToString>(&mut self, initial_value: S) -> &mut Self
Specify the initial value.
§Examples
use may_clack::multi_input;
let answers = multi_input("message")
.initial_value("initial_value")
.interact()?;
println!("answers {:?}", answers);
Sourcepub fn placeholder<S: ToString>(&mut self, placeholder: S) -> &mut Self
pub fn placeholder<S: ToString>(&mut self, placeholder: S) -> &mut Self
Specify a placeholder.
§Examples
use may_clack::multi_input;
let answers = multi_input("message")
.placeholder("placeholder")
.interact()?;
println!("answers {:?}", answers);
Sourcepub fn min(&mut self, min: u16) -> &mut Self
pub fn min(&mut self, min: u16) -> &mut Self
Specify the minimum amount of answers.
use may_clack::multi_input;
let answers = multi_input("message").min(2).interact()?;
println!("answers {:?}", answers);
Sourcepub fn max(&mut self, max: u16) -> &mut Self
pub fn max(&mut self, max: u16) -> &mut Self
Specify the maximum amount of answers. Will automatically submit when that amount is reached.
§Examples
use may_clack::multi_input;
let answers = multi_input("message").max(4).interact()?;
println!("answers {:?}", answers);
Examples found in repository?
examples/full.rs (line 18)
7fn main() -> Result<(), ClackError> {
8 println!();
9 intro!(" full ".reversed());
10
11 info!("visit the documentation at https://docs.rs/may-clack");
12
13 let do_input = input("input")
14 .placeholder("placeholder")
15 .cancel(do_cancel)
16 .required()?;
17 let do_multi_input = multi_input("multi input")
18 .max(4)
19 .cancel(do_cancel)
20 .interact()?;
21 let do_confirm = confirm("confirm")
22 .prompts("true", "false")
23 .cancel(do_cancel)
24 .interact()?;
25 let do_multi_select = multi_select("multi select")
26 .option("opt1", "option 1")
27 .option("opt2", "option 2")
28 .option_hint("opt3", "option 3", "hint")
29 .cancel(do_cancel)
30 .interact()?;
31 let do_select = select("select")
32 .option("val1", "value 1")
33 .option("val2", "value 2")
34 .option_hint("val 3", "value 3", "hint")
35 .cancel(do_cancel)
36 .interact()?;
37
38 outro!();
39
40 println!("input {do_input:?}");
41 println!("confirm {do_confirm:?}");
42 println!("multi_input {do_multi_input:?}");
43 println!("multi_select {do_multi_select:?}");
44 println!("select {do_select:?}");
45
46 Ok(())
47}
Sourcepub fn validate<F>(&mut self, validate: F) -> &mut Self
pub fn validate<F>(&mut self, validate: F) -> &mut Self
Specify a validation function.
On a successful validation, return a None
from the closure,
and on an unsuccessful validation return a Some<&'static str>
with the error message.
§Examples
use may_clack::multi_input;
let answers = multi_input("message")
.validate(|x| {
if x.find(char::is_whitespace).is_some() {
Err(Cow::Borrowed("whitespace is disallowed"))
} else {
Ok(())
}
})
.interact()?;
println!("answers {:?}", answers);
Examples found in repository?
examples/validate.rs (lines 20-26)
5fn main() -> Result<(), ClackError> {
6 println!();
7 intro!(" validate ".reversed());
8
9 let do_validate_input = input("validate single (only use ascii)")
10 .validate(|x| {
11 if x.is_ascii() {
12 Ok(())
13 } else {
14 Err(Cow::Borrowed("only use ascii characters"))
15 }
16 })
17 .cancel(do_cancel)
18 .required()?;
19 let do_validate_multi_input = multi_input("validate multi (only use lowercase)")
20 .validate(|x| {
21 if x.find(char::is_uppercase).is_some() {
22 Err(Cow::Borrowed("only use lowercase characters"))
23 } else {
24 Ok(())
25 }
26 })
27 .cancel(do_cancel)
28 .interact()?;
29 let do_parse_input = input("parse to u8").cancel(do_cancel).parse::<u8>()?;
30 let do_maybe_parse = input("maybe parse to ipv4 addr").maybe_parse::<Ipv4Addr>()?;
31 let do_parse_multi = multi_input("parse multiple to u8")
32 .cancel(do_cancel)
33 .parse::<u8>()?;
34
35 outro!();
36
37 println!("single {do_validate_input:?}");
38 println!("multi {do_validate_multi_input:?}");
39 println!("parse single {do_parse_input:?}");
40 println!("maybe parse single {do_maybe_parse:?}");
41 println!("parse multi {do_parse_multi:?}");
42
43 Ok(())
44}
Sourcepub fn cancel<F>(&mut self, cancel: F) -> &mut Selfwhere
F: Fn() + 'static,
pub fn cancel<F>(&mut self, cancel: F) -> &mut Selfwhere
F: Fn() + 'static,
Specify function to call on cancel.
§Examples
use may_clack::{multi_input, cancel};
let answers = multi_input("message").cancel(do_cancel).interact()?;
println!("answers {:?}", answers);
fn do_cancel() {
cancel!("operation cancelled");
panic!("operation cancelled");
}
Examples found in repository?
examples/generic.rs (line 10)
4fn main() -> Result<(), ClackError> {
5 println!();
6 intro!(" generic messages ".reversed());
7
8 let number = confirm(20).cancel(do_cancel).interact()?;
9 let styled = multi_input("style".on_cyan())
10 .cancel(do_cancel)
11 .interact()?;
12
13 outro!();
14
15 println!("number {number:?}");
16 println!("styled {styled:?}");
17
18 Ok(())
19}
More examples
examples/full.rs (line 19)
7fn main() -> Result<(), ClackError> {
8 println!();
9 intro!(" full ".reversed());
10
11 info!("visit the documentation at https://docs.rs/may-clack");
12
13 let do_input = input("input")
14 .placeholder("placeholder")
15 .cancel(do_cancel)
16 .required()?;
17 let do_multi_input = multi_input("multi input")
18 .max(4)
19 .cancel(do_cancel)
20 .interact()?;
21 let do_confirm = confirm("confirm")
22 .prompts("true", "false")
23 .cancel(do_cancel)
24 .interact()?;
25 let do_multi_select = multi_select("multi select")
26 .option("opt1", "option 1")
27 .option("opt2", "option 2")
28 .option_hint("opt3", "option 3", "hint")
29 .cancel(do_cancel)
30 .interact()?;
31 let do_select = select("select")
32 .option("val1", "value 1")
33 .option("val2", "value 2")
34 .option_hint("val 3", "value 3", "hint")
35 .cancel(do_cancel)
36 .interact()?;
37
38 outro!();
39
40 println!("input {do_input:?}");
41 println!("confirm {do_confirm:?}");
42 println!("multi_input {do_multi_input:?}");
43 println!("multi_select {do_multi_select:?}");
44 println!("select {do_select:?}");
45
46 Ok(())
47}
examples/validate.rs (line 27)
5fn main() -> Result<(), ClackError> {
6 println!();
7 intro!(" validate ".reversed());
8
9 let do_validate_input = input("validate single (only use ascii)")
10 .validate(|x| {
11 if x.is_ascii() {
12 Ok(())
13 } else {
14 Err(Cow::Borrowed("only use ascii characters"))
15 }
16 })
17 .cancel(do_cancel)
18 .required()?;
19 let do_validate_multi_input = multi_input("validate multi (only use lowercase)")
20 .validate(|x| {
21 if x.find(char::is_uppercase).is_some() {
22 Err(Cow::Borrowed("only use lowercase characters"))
23 } else {
24 Ok(())
25 }
26 })
27 .cancel(do_cancel)
28 .interact()?;
29 let do_parse_input = input("parse to u8").cancel(do_cancel).parse::<u8>()?;
30 let do_maybe_parse = input("maybe parse to ipv4 addr").maybe_parse::<Ipv4Addr>()?;
31 let do_parse_multi = multi_input("parse multiple to u8")
32 .cancel(do_cancel)
33 .parse::<u8>()?;
34
35 outro!();
36
37 println!("single {do_validate_input:?}");
38 println!("multi {do_validate_multi_input:?}");
39 println!("parse single {do_parse_input:?}");
40 println!("maybe parse single {do_maybe_parse:?}");
41 println!("parse multi {do_parse_multi:?}");
42
43 Ok(())
44}
Sourcepub fn parse<T: FromStr + Display>(&self) -> Result<Vec<T>, ClackError>
pub fn parse<T: FromStr + Display>(&self) -> Result<Vec<T>, ClackError>
Like MultiInput::interact()
, but parses the value before returning.
§Examples
use may_clack::multi_input;
let answers: Vec<i32> = multi_input("message").min(2).parse::<i32>()?;
println!("answers {:?}", answers);
Examples found in repository?
examples/validate.rs (line 33)
5fn main() -> Result<(), ClackError> {
6 println!();
7 intro!(" validate ".reversed());
8
9 let do_validate_input = input("validate single (only use ascii)")
10 .validate(|x| {
11 if x.is_ascii() {
12 Ok(())
13 } else {
14 Err(Cow::Borrowed("only use ascii characters"))
15 }
16 })
17 .cancel(do_cancel)
18 .required()?;
19 let do_validate_multi_input = multi_input("validate multi (only use lowercase)")
20 .validate(|x| {
21 if x.find(char::is_uppercase).is_some() {
22 Err(Cow::Borrowed("only use lowercase characters"))
23 } else {
24 Ok(())
25 }
26 })
27 .cancel(do_cancel)
28 .interact()?;
29 let do_parse_input = input("parse to u8").cancel(do_cancel).parse::<u8>()?;
30 let do_maybe_parse = input("maybe parse to ipv4 addr").maybe_parse::<Ipv4Addr>()?;
31 let do_parse_multi = multi_input("parse multiple to u8")
32 .cancel(do_cancel)
33 .parse::<u8>()?;
34
35 outro!();
36
37 println!("single {do_validate_input:?}");
38 println!("multi {do_validate_multi_input:?}");
39 println!("parse single {do_parse_input:?}");
40 println!("maybe parse single {do_maybe_parse:?}");
41 println!("parse multi {do_parse_multi:?}");
42
43 Ok(())
44}
Sourcepub fn interact(&self) -> Result<Vec<String>, ClackError>
pub fn interact(&self) -> Result<Vec<String>, ClackError>
Waits for the user to submit a line of text.
Returns None
on an empty line and Some::<String>
otherwise.
§Examples
use may_clack::{cancel, multi_input};
let answers = multi_input("message")
.validate(|x| {
if x.contains('\0') {
Err(Cow::Borrowed("contains nul byte"))
} else {
Ok(())
}
})
.cancel(do_cancel)
.interact()?;
println!("answers {:?}", answers);
fn do_cancel() {
cancel!("operation cancelled");
std::process::exit(1);
}
Examples found in repository?
examples/generic.rs (line 11)
4fn main() -> Result<(), ClackError> {
5 println!();
6 intro!(" generic messages ".reversed());
7
8 let number = confirm(20).cancel(do_cancel).interact()?;
9 let styled = multi_input("style".on_cyan())
10 .cancel(do_cancel)
11 .interact()?;
12
13 outro!();
14
15 println!("number {number:?}");
16 println!("styled {styled:?}");
17
18 Ok(())
19}
More examples
examples/full.rs (line 20)
7fn main() -> Result<(), ClackError> {
8 println!();
9 intro!(" full ".reversed());
10
11 info!("visit the documentation at https://docs.rs/may-clack");
12
13 let do_input = input("input")
14 .placeholder("placeholder")
15 .cancel(do_cancel)
16 .required()?;
17 let do_multi_input = multi_input("multi input")
18 .max(4)
19 .cancel(do_cancel)
20 .interact()?;
21 let do_confirm = confirm("confirm")
22 .prompts("true", "false")
23 .cancel(do_cancel)
24 .interact()?;
25 let do_multi_select = multi_select("multi select")
26 .option("opt1", "option 1")
27 .option("opt2", "option 2")
28 .option_hint("opt3", "option 3", "hint")
29 .cancel(do_cancel)
30 .interact()?;
31 let do_select = select("select")
32 .option("val1", "value 1")
33 .option("val2", "value 2")
34 .option_hint("val 3", "value 3", "hint")
35 .cancel(do_cancel)
36 .interact()?;
37
38 outro!();
39
40 println!("input {do_input:?}");
41 println!("confirm {do_confirm:?}");
42 println!("multi_input {do_multi_input:?}");
43 println!("multi_select {do_multi_select:?}");
44 println!("select {do_select:?}");
45
46 Ok(())
47}
examples/validate.rs (line 28)
5fn main() -> Result<(), ClackError> {
6 println!();
7 intro!(" validate ".reversed());
8
9 let do_validate_input = input("validate single (only use ascii)")
10 .validate(|x| {
11 if x.is_ascii() {
12 Ok(())
13 } else {
14 Err(Cow::Borrowed("only use ascii characters"))
15 }
16 })
17 .cancel(do_cancel)
18 .required()?;
19 let do_validate_multi_input = multi_input("validate multi (only use lowercase)")
20 .validate(|x| {
21 if x.find(char::is_uppercase).is_some() {
22 Err(Cow::Borrowed("only use lowercase characters"))
23 } else {
24 Ok(())
25 }
26 })
27 .cancel(do_cancel)
28 .interact()?;
29 let do_parse_input = input("parse to u8").cancel(do_cancel).parse::<u8>()?;
30 let do_maybe_parse = input("maybe parse to ipv4 addr").maybe_parse::<Ipv4Addr>()?;
31 let do_parse_multi = multi_input("parse multiple to u8")
32 .cancel(do_cancel)
33 .parse::<u8>()?;
34
35 outro!();
36
37 println!("single {do_validate_input:?}");
38 println!("multi {do_validate_multi_input:?}");
39 println!("parse single {do_parse_input:?}");
40 println!("maybe parse single {do_maybe_parse:?}");
41 println!("parse multi {do_parse_multi:?}");
42
43 Ok(())
44}
Auto Trait Implementations§
impl<M> Freeze for MultiInput<M>where
M: Freeze,
impl<M> !RefUnwindSafe for MultiInput<M>
impl<M> !Send for MultiInput<M>
impl<M> !Sync for MultiInput<M>
impl<M> Unpin for MultiInput<M>where
M: Unpin,
impl<M> !UnwindSafe for MultiInput<M>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<D> OwoColorize for D
impl<D> OwoColorize for D
Source§fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
fn fg<C>(&self) -> FgColorDisplay<'_, C, Self>where
C: Color,
Set the foreground color generically Read more
Source§fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
fn bg<C>(&self) -> BgColorDisplay<'_, C, Self>where
C: Color,
Set the background color generically. Read more
Source§fn black(&self) -> FgColorDisplay<'_, Black, Self>
fn black(&self) -> FgColorDisplay<'_, Black, Self>
Change the foreground color to black
Source§fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
fn on_black(&self) -> BgColorDisplay<'_, Black, Self>
Change the background color to black
Source§fn red(&self) -> FgColorDisplay<'_, Red, Self>
fn red(&self) -> FgColorDisplay<'_, Red, Self>
Change the foreground color to red
Source§fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
fn on_red(&self) -> BgColorDisplay<'_, Red, Self>
Change the background color to red
Source§fn green(&self) -> FgColorDisplay<'_, Green, Self>
fn green(&self) -> FgColorDisplay<'_, Green, Self>
Change the foreground color to green
Source§fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
fn on_green(&self) -> BgColorDisplay<'_, Green, Self>
Change the background color to green
Source§fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
fn yellow(&self) -> FgColorDisplay<'_, Yellow, Self>
Change the foreground color to yellow
Source§fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
fn on_yellow(&self) -> BgColorDisplay<'_, Yellow, Self>
Change the background color to yellow
Source§fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
fn blue(&self) -> FgColorDisplay<'_, Blue, Self>
Change the foreground color to blue
Source§fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
fn on_blue(&self) -> BgColorDisplay<'_, Blue, Self>
Change the background color to blue
Source§fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
fn magenta(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to magenta
Source§fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_magenta(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to magenta
Source§fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
fn purple(&self) -> FgColorDisplay<'_, Magenta, Self>
Change the foreground color to purple
Source§fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
fn on_purple(&self) -> BgColorDisplay<'_, Magenta, Self>
Change the background color to purple
Source§fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
fn cyan(&self) -> FgColorDisplay<'_, Cyan, Self>
Change the foreground color to cyan
Source§fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
fn on_cyan(&self) -> BgColorDisplay<'_, Cyan, Self>
Change the background color to cyan
Source§fn white(&self) -> FgColorDisplay<'_, White, Self>
fn white(&self) -> FgColorDisplay<'_, White, Self>
Change the foreground color to white
Source§fn on_white(&self) -> BgColorDisplay<'_, White, Self>
fn on_white(&self) -> BgColorDisplay<'_, White, Self>
Change the background color to white
Source§fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
fn default_color(&self) -> FgColorDisplay<'_, Default, Self>
Change the foreground color to the terminal default
Source§fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
fn on_default_color(&self) -> BgColorDisplay<'_, Default, Self>
Change the background color to the terminal default
Source§fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
fn bright_black(&self) -> FgColorDisplay<'_, BrightBlack, Self>
Change the foreground color to bright black
Source§fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
fn on_bright_black(&self) -> BgColorDisplay<'_, BrightBlack, Self>
Change the background color to bright black
Source§fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
fn bright_red(&self) -> FgColorDisplay<'_, BrightRed, Self>
Change the foreground color to bright red
Source§fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
fn on_bright_red(&self) -> BgColorDisplay<'_, BrightRed, Self>
Change the background color to bright red
Source§fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
fn bright_green(&self) -> FgColorDisplay<'_, BrightGreen, Self>
Change the foreground color to bright green
Source§fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
fn on_bright_green(&self) -> BgColorDisplay<'_, BrightGreen, Self>
Change the background color to bright green
Source§fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
fn bright_yellow(&self) -> FgColorDisplay<'_, BrightYellow, Self>
Change the foreground color to bright yellow
Source§fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
fn on_bright_yellow(&self) -> BgColorDisplay<'_, BrightYellow, Self>
Change the background color to bright yellow
Source§fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
fn bright_blue(&self) -> FgColorDisplay<'_, BrightBlue, Self>
Change the foreground color to bright blue
Source§fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
fn on_bright_blue(&self) -> BgColorDisplay<'_, BrightBlue, Self>
Change the background color to bright blue
Source§fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_magenta(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright magenta
Source§fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_magenta(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright magenta
Source§fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
fn bright_purple(&self) -> FgColorDisplay<'_, BrightMagenta, Self>
Change the foreground color to bright purple
Source§fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
fn on_bright_purple(&self) -> BgColorDisplay<'_, BrightMagenta, Self>
Change the background color to bright purple
Source§fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
fn bright_cyan(&self) -> FgColorDisplay<'_, BrightCyan, Self>
Change the foreground color to bright cyan
Source§fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
fn on_bright_cyan(&self) -> BgColorDisplay<'_, BrightCyan, Self>
Change the background color to bright cyan
Source§fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
fn bright_white(&self) -> FgColorDisplay<'_, BrightWhite, Self>
Change the foreground color to bright white
Source§fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
fn on_bright_white(&self) -> BgColorDisplay<'_, BrightWhite, Self>
Change the background color to bright white
Source§fn bold(&self) -> BoldDisplay<'_, Self>
fn bold(&self) -> BoldDisplay<'_, Self>
Make the text bold
Source§fn dimmed(&self) -> DimDisplay<'_, Self>
fn dimmed(&self) -> DimDisplay<'_, Self>
Make the text dim
Source§fn italic(&self) -> ItalicDisplay<'_, Self>
fn italic(&self) -> ItalicDisplay<'_, Self>
Make the text italicized
Source§fn underline(&self) -> UnderlineDisplay<'_, Self>
fn underline(&self) -> UnderlineDisplay<'_, Self>
Make the text underlined
Source§fn blink(&self) -> BlinkDisplay<'_, Self>
fn blink(&self) -> BlinkDisplay<'_, Self>
Make the text blink
Source§fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
fn blink_fast(&self) -> BlinkFastDisplay<'_, Self>
Make the text blink (but fast!)
Source§fn reversed(&self) -> ReversedDisplay<'_, Self>
fn reversed(&self) -> ReversedDisplay<'_, Self>
Swap the foreground and background colors
Hide the text
Source§fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
fn strikethrough(&self) -> StrikeThroughDisplay<'_, Self>
Cross out the text
Source§fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn color<Color>(&self, color: Color) -> FgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the foreground color at runtime. Only use if you do not know which color will be used at
compile-time. If the color is constant, use either
OwoColorize::fg
or
a color-specific method, such as OwoColorize::green
, Read moreSource§fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
fn on_color<Color>(&self, color: Color) -> BgDynColorDisplay<'_, Color, Self>where
Color: DynColor,
Set the background color at runtime. Only use if you do not know what color to use at
compile-time. If the color is constant, use either
OwoColorize::bg
or
a color-specific method, such as OwoColorize::on_yellow
, Read moreSource§fn fg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn fg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> FgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the foreground color to a specific RGB value.
Source§fn bg_rgb<const R: u8, const G: u8, const B: u8>(
&self,
) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
fn bg_rgb<const R: u8, const G: u8, const B: u8>( &self, ) -> BgColorDisplay<'_, CustomColor<R, G, B>, Self>
Set the background color to a specific RGB value.
Source§fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
fn truecolor(&self, r: u8, g: u8, b: u8) -> FgDynColorDisplay<'_, Rgb, Self>
Sets the foreground color to an RGB value.
Source§fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
fn on_truecolor(&self, r: u8, g: u8, b: u8) -> BgDynColorDisplay<'_, Rgb, Self>
Sets the background color to an RGB value.