Skip to main content

styled

Macro styled 

Source
macro_rules! styled {
    ($raw:expr) => { ... };
}
Expand description

Parses rich syntax into a StyledStr in compile time.

ยงExamples

use styled_str::{styled, StyledStr};

const STYLED: StyledStr = styled!(
    "[[bold red on white]]ERROR:[[/]] [[it]]Something[[/]] \
     [[strike]]bad[[/]] happened"
);
assert_eq!(STYLED.text(), "ERROR: Something bad happened");
assert_eq!(STYLED.span(0).unwrap().text, "ERROR:");