Trait rpf::Exit [] [src]

pub trait Exit {
    fn exit(&self, status: ExitStatus);
    fn error(&self, mesg: String, status: ExitStatus);
    fn path_error(&self, mesg: String, item: PathBuf);
}

Required Methods

fn exit(&self, status: ExitStatus)

Wrapper for process::exit, immediately exits the process with the set exit status.

Example

use rpf::{Prog,Exit,ExitStatus};

let prog = Prog { name: "test", vers: "0.1.0", yr: "2015" };
prog.exit(ExitStatus::Ok);

fn error(&self, mesg: String, status: ExitStatus)

Used for errors, prints error messages in red terminal font and calls rpf::Exit::exit

Example

use rpf::{Prog,Exit,ExitStatus};

let prog = Prog { name: "test", vers: "0.1.0", yr: "2015" };
prog.error("Some kind of error occured!".to_string(), ExitStatus::Error);

fn path_error(&self, mesg: String, item: PathBuf)

Used for errors when working with paths, works similar to error

Implementors