Skip to main content

prefix

Macro prefix 

Source
macro_rules! prefix {
    ($name:expr, $prefix:expr) => { ... };
}
Expand description

Sets a prefix string on a previously defined named style.

The prefix is injected as a literal string before the style’s ANSI escape sequence when rendered. The style must already exist in the registry; call [style!] first.

§Panics

Panics if $name has not been registered. Use set_prefix directly to handle this case without panicking.

§Example

style!("warn", "[yellow]");
prefix!("warn", "⚠ ");
// [warn] now renders "⚠ " followed by the yellow escape sequence