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
46
// err!,errln!
#[macro_export]
macro_rules! err {
    ($($arg:tt)*) => {
        {
        use std::io::{self, Write};
        use std::error::Error;
        let str=format!($($arg)*);
    match io::stderr().write(&str.as_bytes()) {
        Ok(_) => {}
        Err(e) => panic!("panic!: to err! '{}' met '{}'", &str, e.description()),
        // Panics if writing to io::stdout() fails.
    };
        }
        };
}
#[macro_export]
macro_rules! errln {
       () => (err!("\n"));
       ($fmt:expr) => (err!(concat!($fmt, "\n")));
        ($fmt:expr, $($arg:tt)*) => (err!(concat!($fmt, "\n"), $($arg)*));
        // Panics if writing to io::stdout() fails.
}

// errst!,errstln!
#[macro_export]
macro_rules! errst {
    ($($arg:tt)*) => {
        {
        use std::io::{self, Write};
        let str=format!($($arg)*);
    match io::stderr().write(&str.as_bytes()) {
        Ok(_) => {}
        Err(_) => {}
        // Do nothing if writing to io::stdout() fails(silent->st).
    };
        }
        };
}
#[macro_export]
macro_rules! errstln {
       () => (errst!("\n"));
       ($fmt:expr) => (errst!(concat!($fmt, "\n")));
        ($fmt:expr, $($arg:tt)*) => (errst!(concat!($fmt, "\n"), $($arg)*));
        // Do nothing if writing to io::stdout() fails(silent->st).
}