[−][src]Macro failchain::ensure
Returns early with an error built from an error kind if a given condition is false.
Examples
// With an ErrorKind. ensure!( file_path != corrupt_file_path, ErrorKind::CorruptFile(format!("the file at {:?} is corrupt", file_path)) ); // With an ErrorKind and format string (equivalent ot the above.) ensure!( file_path != corrupt_file_path, ErrorKind::CorruptFile, "the file at {:?} is corrupt", file_path, );