1pub mod changes;
2pub mod dependencies;
3pub mod indexes;
4pub mod interactive;
5pub mod locking;
6pub mod output;
7pub mod selection;
8pub mod workspace;
9
10use std::sync::atomic::{AtomicBool, Ordering};
11
12pub static INTERRUPTED: AtomicBool = AtomicBool::new(false);
13
14#[derive(Debug)]
15pub struct Interrupted;
16
17impl std::fmt::Display for Interrupted {
18 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19 f.write_str("Interrupted.")
20 }
21}
22
23impl std::error::Error for Interrupted {}
24
25pub fn check_interrupt() -> anyhow::Result<()> {
26 if INTERRUPTED.load(Ordering::Relaxed) {
27 return Err(Interrupted.into());
28 }
29 Ok(())
30}