program 0.3.0

Program: provide a rust analogue to C's perror
Documentation
  • Coverage
  • 100%
    2 out of 2 items documented0 out of 1 items with examples
  • Size
  • Source code size: 3.99 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 990.41 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • nickrtorres/program
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • nickrtorres

Program

Program emulates C's perror.

Crates.io

use program::perror;
use std::io::{self};

fn print_msg(_: &str) -> io::Result<()> {
    Err(io::Error::new(
        io::ErrorKind::Other,
        "something went wrong!",
    ))
}

fn main() {
    if let Err(e) = print_msg("Hello, world!") {
        perror(e);
    }
}
$ cargo run
   Compiling example v0.1.0 (/root/example)
    Finished dev [unoptimized + debuginfo] target(s) in 0.34s
     Running `target/debug/example`
example: something went wrong!