stati/
macros.rs

1/// the same as [`print!`] from the std lib,
2/// but it displays text through the provided [`BarManager`]
3/// instead of printing it directly, allowing printing without
4/// breaking the progressbar
5///
6/// [`BarManager`]: crate::manager::BarManager
7/// [`print!`]: std::print
8#[macro_export]
9macro_rules! print {
10    ($bm:ident, $($arg:tt)*) => ({
11        $bm.queue_text(&format!($($arg)*));
12        $bm.print();
13    })
14}
15
16/// the same as [`println!`] from the std lib,
17/// but it displays text through the provided [`BarManager`]
18/// instead of printing it directly, allowing printing without
19/// breaking the progressbar
20///
21/// [`BarManager`]: crate::manager::BarManager
22/// [`println!`]: std::println
23#[macro_export]
24macro_rules! println {
25    ($bm: ident) => ($bm.queue_text("\n"));
26    ($bm:ident, $($arg:tt)*) => ({
27        $bm.queue_text(&format!("{}\n", format!($($arg)*)));
28        $bm.print();
29    })
30}