pub struct Console { /* private fields */ }
Expand description
Used to print messages to the console according to a Verbosity level
Implementations
sourceimpl Console
impl Console
sourcepub fn with_verbosity(verbosity: Verbosity) -> Self
pub fn with_verbosity(verbosity: Verbosity) -> Self
Create a new console with the given verbosity
sourcepub fn print_message(&self, message: &str)
pub fn print_message(&self, message: &str)
Print a message to the console (using standard output)
sourcepub fn print_error(&self, error: &str)
pub fn print_error(&self, error: &str)
Print an error message to the console (using standard error)
sourcepub fn print_replacement(&self, prefix: &str, replacement: &Replacement<'_>)
pub fn print_replacement(&self, prefix: &str, replacement: &Replacement<'_>)
Print the replacement as two lines (red then green)
use ruplacer::{Console, Query, replace};
let input = "let foo_bar = FooBar::new();";
let query = Query::subvert("foo_bar", "spam_eggs");
let replacement = replace(input, &query).unwrap();
let console = Console::new();
console.print_replacement("foo.rs:3", &replacement);
// outputs:
// foo.rs:3 let foo_bar = FooBar::new()
// foo.rs:3 let spam_eggs = SpamEggs::new()
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Console
impl Send for Console
impl Sync for Console
impl Unpin for Console
impl UnwindSafe for Console
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more