pub struct Stylesheet { /* fields omitted */ }
Construct a new stylesheet
Add a segment to the stylesheet.
Using style strings:
let stylesheet = Stylesheet::new()
.add("message header * code", "weight: bold; fg: red");
assert_eq!(stylesheet.get(&["message", "header", "error", "code"]),
Some(Style("weight: bold; fg: red")))
Using typed styles:
let stylesheet = Stylesheet::new()
.add("message header * code", Style::new().bold().fg(Color::Red));
assert_eq!(stylesheet.get(&["message", "header", "error", "code"]),
Some(Style("weight: bold; fg: red")))
Get the style associated with a nesting.
let stylesheet = Stylesheet::new()
.add("message ** code", "fg: blue")
.add("message header * code", "weight: bold; fg: red");
let style = stylesheet.get(&["message", "header", "error", "code"]);
Formats the value using the given formatter. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static