Macro assertables::assume_io[][src]

macro_rules! assume_io {
    ($x:expr $(,)?) => { ... };
    ($x:expr, $($arg:tt)+) => { ... };
}
Expand description

Assume a condition is true.

  • When true, return Ok(true).

  • Otherwise, return Err with a message and the values of the expressions with their debug representations.

Example

let x = assume_io!(true);
//-> Ok(true)
let x = assume_io!(false);
//-> Err(
//       std::io::Error::new(
//           std::io::ErrorKind::InvalidInput,
//           "assumption failed: `assume_io(condition) condition: `false`"
//       )
//   )

This macro has a second form where a custom message can be provided.