1pub fn shutdown_channel() -> Result<tokio::sync::broadcast::Receiver<bool>, ctrlc::Error> {
3 let (tx, rx) = tokio::sync::broadcast::channel::<bool>(1);
4
5 ctrlc
7 ::set_handler(move || {
8 tx.send(true).unwrap();
9 })
10 .expect("Error setting Ctrl-C handler");
11
12 Ok(rx)
13}
14
15pub mod constants {
16 pub const VERSION: &str = "0.1.4";
17
18 pub const DEBUGGING: bool = cfg!(debug_assertions);
19
20 pub const TICK_RATE: i32 = 30;
22 pub const MS_PER_TICK: u64 = 1000 / (TICK_RATE as u64);
23
24 pub const DEFAULT_IP: &str = "127.0.0.1";
25 pub const MASTER_PORT: u16 = 6256;
26 pub const CLUSTER_PORT: u16 = 6257;
27
28 pub const TERMINAL_BG_GRAY: &str = "\x1b[47m";
29 pub const TERMINAL_DEFAULT: &str = "\x1b[39m";
30 pub const TERMINAL_BLACK: &str = "\x1b[30m";
31 pub const TERMINAL_WHITE: &str = "\x1b[97m";
32 pub const TERMINAL_RED: &str = "\x1b[91m";
33 pub const TERMINAL_GREEN: &str = "\x1b[92m";
34 pub const TERMINAL_BLUE: &str = "\x1b[94m";
35 pub const TERMINAL_ORANGE: &str = "\x1b[93m";
36}