silverwolf-x's picture
download
raw
1.07 kB
use std::fmt::Display;
use owo_colors::{OwoColorize, Style};
#[derive(Clone, Copy)]
pub enum FormattingMode {
/// No formatting, just print the output
Plain,
/// Use ansi colors to format the output
AnsiColors,
}
impl FormattingMode {
pub fn magic_identifier<'a>(&self, content: impl Display + 'a) -> impl Display + 'a {
match self {
FormattingMode::Plain => format!("{{{content}}}"),
FormattingMode::AnsiColors => format!("{{{content}}}").italic().to_string(),
}
}
pub fn lowlight<'a>(&self, content: impl Display + 'a) -> impl Display + 'a {
match self {
FormattingMode::Plain => Style::new(),
FormattingMode::AnsiColors => Style::new().dimmed(),
}
.style(content)
}
pub fn highlight<'a>(&self, content: impl Display + 'a) -> impl Display + 'a {
match self {
FormattingMode::Plain => Style::new(),
FormattingMode::AnsiColors => Style::new().bold().underline(),
}
.style(content)
}
}

Xet Storage Details

Size:
1.07 kB
·
Xet hash:
1f7b8d1362e6e28319d806bd9d00784b18619312e8f1dd69ffd97c285cba5557

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.