diff --git a/src/console.rs b/src/console.rs index a2aaf86..8dabf68 100644 --- a/src/console.rs +++ b/src/console.rs @@ -11,19 +11,25 @@ impl Default for Verbosity { } #[derive(Debug, Default)] +/// Used to print messages to the console according to a Verbosity +/// level pub struct Console { verbosity: Verbosity, } impl Console { + /// Create a new console with the given verbosity pub fn with_verbosity(verbosity: Verbosity) -> Self { Self { verbosity } } + /// Create a new console with default verbosity pub fn new() -> Self { Default::default() } + /// Print a message to the console + /// (using standard output) pub fn print_message(&self, message: &str) { if matches!(self.verbosity, Verbosity::Quiet) { return; @@ -31,6 +37,8 @@ impl Console { print!("{message}"); } + /// Print an error message to the console + /// (using standard error) pub fn print_error(&self, error: &str) { eprintln!("{error}"); }