macro_rules! text {
() => { ... };
($($rest:tt)*) => { ... };
}Expand description
Macro to declare a list of text segments. A segment can be written as
"text"(a string literal){expr}(an expression that evaluates to a string slice)
Each segment can be preceded by one of
c:, wherecis aStylevariant; the segment is styled if supported, otherwise it is wrapped in backticksc!, wherecis aStylevariant; the segment is styled if supported, otherwise no formatting is applied
Each color style can be abbreviated with its first letter (cyan ➔ c, green ➔ g,
magenta ➔ m, red ➔ r, yellow ➔ y); use an uppercase letter to make it
bold (bold cyan ➔ C, etc.). The Underline and UnderlineBold styles
are abbreviated as u and U, respectively.
Segments are not separated with commas, for example:
// "warning" is yellow and bold, "world" is cyan, or wrapped in backticks
let _segments = text!(Y!"warning" ": hello" c:"world");
// the value of an build-time environment variable is printed in magenta
let _segments = text!("version is " m!{env!("CARGO_PKG_VERSION")});