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

/// the same as [`println!`] from the std lib,
/// but it displays text through the provided [`BarManager`]
/// instead of printing it directly, allowing printing without
/// breaking the progressbar
///
/// [`BarManager`]: crate::manager::BarManager
/// [`println!`]: std::println
#[macro_export]
macro_rules! println {
    ($bm: ident) => ($bm.queue_text("\n"));
    ($bm:ident, $($arg:tt)*) => ({
        $bm.queue_text(&format!("{}\n", format!($($arg)*)));
        $bm.print();
    })
}