Macro assert_pending

Source
macro_rules! assert_pending {
    ($a:expr $(,)?) => { ... };
    ($a:expr, $($message:tt)+) => { ... };
}
Expand description

Assert an expression is Pending.

Pseudocode:
a is Pending

  • If true, return ().

  • Otherwise, call panic! with a message and the values of the expressions with their debug representations.

§Examples

use assertables::*;
use std::task::Poll;
use std::task::Poll::*;
let a: Poll<i8> = Pending;
assert_pending!(a);

// This will panic
let a: Poll<i8> = Ready(1);
assert_pending!(a);
// assertion failed: `assert_pending!(a)`
// https://docs.rs/assertables/…/assertables/macro.assert_pending.html
//  a label: `a`,
//  a debug: `Ready(1)`

§Module macros