Crate io_ensure

source ·
Expand description

Prototype of the std::io::ensure family of macros.

Examples

use io_ensure::*;
use std::io::ErrorKind;

let a = 3;
let b = 1 + 2;
ensure!(a == b, ErrorKind::Other);
ensure!(a == b, ErrorKind::Interrupted, "we are testing addition with {} and {}", a, b);

Macros

Exits a function early with an io::Error if the condition is not satisfied.
Exits a function early with an io::Error if two expressions are not equal to each other.
Exits a function early with an io::Error if two expressions are equal to each other.
Creates an io::Error using optional interpolation of runtime expressions.