Skip to main content

spans

Macro spans 

Source
macro_rules! spans {
    ($(($style:expr, $text:expr)),* $(,)?) => { ... };
}
Expand description

Build a Line from a list of (Style, text) pairs.

Each pair becomes a Span with the given style. The resulting Line is equivalent to calling Line::from(vec![Span::styled(t, s), ...]) but with less boilerplate for multi-segment event-log text.

§Examples

use retroglyph_core::spans;
use retroglyph_core::color::Style;
use retroglyph_core::color::Color;

let line = spans![
    (Style::new().fg(Color::CYAN), "snowtroop "),
    (Style::default(), "→ 1 hit"),
];
assert_eq!(line.width(), 17);