use std::fmt::Display;
#[derive(Clone, Copy, Debug)]
pub struct Report {
depth: u8,
}
impl Report {
pub fn new() -> Self {
Self { depth: 0 }
}
pub fn incr(self) -> Self {
Self {
depth: self.depth + 1,
}
}
}
impl Display for Report {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
for _ in 0..self.depth {
f.write_str(" ")?;
}
Ok(())
}
}
macro_rules! report {
($report:expr, $($arg:tt)*) => {{
use colored::Colorize as _;
print!("{}{} ", $report, "•".black());
println!($($arg)*)
}}
}
macro_rules! report_success {
($report:expr, $($arg:tt)*) => {{
use colored::Colorize as _;
print!("{}{} ", $report, "".green());
println!($($arg)*)
}}
}
macro_rules! report_error {
($report:expr, $($arg:tt)*) => {{
use colored::Colorize as _;
print!("{}{} ", $report, "".red());
println!($($arg)*)
}}
}
macro_rules! report_info {
($report:expr, $($arg:tt)*) => {{
use colored::Colorize as _;
print!("{}{} ", $report, "".blue());
println!($($arg)*)
}}
}
macro_rules! report_warn {
($report:expr, $($arg:tt)*) => {{
use colored::Colorize as _;
print!("{}{} ", $report, "".yellow());
println!($($arg)*)
}}
}