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
31
32
33
34
35
/*!
 Contains functions that emit a loading message while we do other work
*/

use std::io::{stdout, Write};

/// Write to the CLI while something is working so that we can overwrite it later
///
/// # Example:
///
/// ```
/// use imessage_database::util::output::processing;
///
/// processing();
/// println!("Done working!");
/// ```
pub fn processing() {
    print!("\rProcessing...");
    stdout().flush().unwrap();
}

/// Overwrite the CLI when something is done working so that we can write cleanly later
///
/// # Example:
///
/// ```
/// use imessage_database::util::output::{processing, done_processing};
///
/// processing();
/// done_processing();
/// ```
pub fn done_processing() {
    print!("\r");
    stdout().flush().unwrap();
}