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
36
37
38
39
40
41
42
43
44
45
#[macro_use]
extern crate lazy_static;
extern crate term;
use std::io::{ Error, ErrorKind };
pub mod util_io;
pub mod util_os;
pub mod util_env;
pub mod util_cmd;
pub mod util_msg;
pub mod util_str;
pub mod util_size;
pub mod util_file;
pub mod util_time;
#[macro_export] macro_rules! iff {
($c:expr, $t:expr, $f:expr) => ( if $c { $t } else { $f } )
}
#[macro_export] macro_rules! information {
($($arg:tt)+) => ( rust_util::util_msg::print_info(&format!($($arg)+)); )
}
#[macro_export] macro_rules! success {
($($arg:tt)+) => ( rust_util::util_msg::print_ok(&format!($($arg)+)); )
}
#[macro_export] macro_rules! warning {
($($arg:tt)+) => ( rust_util::util_msg::print_warn(&format!($($arg)+)); )
}
#[macro_export] macro_rules! failure {
($($arg:tt)+) => ( rust_util::util_msg::print_error(&format!($($arg)+)); )
}
#[macro_export] macro_rules! debugging {
($($arg:tt)+) => ( rust_util::util_msg::print_debug(&format!($($arg)+)); )
}
pub type XResult<T> = Result<T, Box<dyn std::error::Error>>;
pub fn new_box_error(m: &str) -> Box<dyn std::error::Error> {
Box::new(Error::new(ErrorKind::Other, m))
}
pub fn new_box_ioerror(m: &str) -> Box<dyn std::error::Error> {
Box::new(Error::new(ErrorKind::Other, m))
}