imessage_database/util/output.rs
1/*!
2 Contains functions that emit a loading message while we do other work.
3*/
4
5use std::io::{stdout, Write};
6
7/// Write to the CLI while something is working so that we can overwrite it later
8///
9/// # Example:
10///
11/// ```
12/// use imessage_database::util::output::processing;
13///
14/// processing();
15/// println!("Done working!");
16/// ```
17pub fn processing() {
18 print!("\rProcessing...");
19 stdout().flush().unwrap_or_default();
20}
21
22/// Overwrite the CLI when something is done working so that we can write cleanly later
23///
24/// # Example:
25///
26/// ```
27/// use imessage_database::util::output::{processing, done_processing};
28///
29/// processing();
30/// done_processing();
31/// ```
32pub fn done_processing() {
33 print!("\r");
34 stdout().flush().unwrap_or_default();
35}