spruce/severity
Generic Birch-style severity/status formatting.
Types
Controls how a Severity is rendered: its style (label, badge, simple, or
custom), whether icons are shown, the glyph mode, and the padding width.
Construct one with label, badge, simple, or custom.
pub opaque type Formatter
Values
pub fn custom(
render: fn(Severity, spruce.Spruce) -> String,
target_width target_width: Int,
) -> Formatter
Render severities with a caller-supplied function.
pub fn icons(formatter: Formatter, enabled: Bool) -> Formatter
Enable or disable icons for formatters that support them.
pub fn mode(formatter: Formatter, mode: symbol.Mode) -> Formatter
Set the glyph mode used by icon-bearing formatters.
pub fn render(
sp: spruce.Spruce,
formatter: Formatter,
severity: Severity,
) -> String
Render a severity with the supplied formatter.
pub fn render_padded(
sp: spruce.Spruce,
formatter: Formatter,
severity: Severity,
) -> String
Render a severity and pad it to the formatter’s visual target width.
pub fn target_width(formatter: Formatter) -> Int
Return the visual target width used by render_padded.
pub fn to_int(severity: Severity) -> Int
Convert a severity to its Birch ordering integer.
pub fn to_string(severity: Severity) -> String
Convert a severity to its uppercase label.
pub fn to_string_lowercase(severity: Severity) -> String
Convert a severity to its lowercase label.