bail

Macro bail 

Source
macro_rules! bail {
    ($e:expr) => { ... };
    ($e:expr,) => { ... };
    ($kind:expr, $fmt:expr) => { ... };
    ($kind:expr, $fmt:expr, $($arg:tt)+) => { ... };
}
Expand description

Returns early with an error built from an error kind.

ยงExamples

// With an ErrorKind.
bail!(ErrorKind::CorruptFile(format!("the file at {:?} is corrupt", file_path)))

// With an ErrorKind and format string (equivalent ot the above.)
bail!(ErrorKind::CorruptFile, "the file at {:?} is corrupt", file_path)