Program
provides a rust analogue, perror
, that emulates C's
perror
from stdio.h
.
Program
is best used alongside lazy_static
.
```rust
use lazystatic::lazystatic;
use program::Program;
lazystatic! { static ref MYPROGRAM: Program = Program::new("head"); }
fn main() { // ...
if something_bad {
MY_PROGRAM.perror("it can print &str")
} else if something_really_bad {
let text = "text";
MY_PROGRAM.perror(format!("it can print formatted {}", text))
} else {
MY_PROGRAM.perror("it can print anything this is std::fmt::Display")
}
} ```