From f694a59dccef877a026c043cee236f57a93033a6 Mon Sep 17 00:00:00 2001 From: sigoden Date: Wed, 8 Mar 2023 11:58:50 +0800 Subject: refactor: replace dump with print_now! (#35) --- src/utils.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/utils.rs') diff --git a/src/utils.rs b/src/utils.rs index 5a18948..76f2b8f 100644 --- a/src/utils.rs +++ b/src/utils.rs @@ -1,8 +1,15 @@ use chrono::prelude::*; use std::io::{stdout, Write}; -pub fn dump(text: T, newlines: usize) { - print!("{}{}", text.to_string(), "\n".repeat(newlines)); +#[macro_export] +macro_rules! print_now { + ($($arg:tt)*) => { + $crate::utils::print_now(&format!($($arg)*)) + }; +} + +pub fn print_now(text: T) { + print!("{}", text.to_string()); let _ = stdout().flush(); } -- cgit v1.2.3