macro_rules! assert_ready_eq {
($cond:expr, $expected:expr $(,)?) => { ... };
($cond:expr, $expected:expr, $($arg:tt)+) => { ... };
}Expand description
Asserts that the left expression contains a [Poll::Ready(T)] variant and its contained value of type
T equals the right expression.
§Uses
Assertions are always checked in both debug and release builds, and cannot be disabled.
See debug_assert_ready_eq! for assertions that are not enabled in release builds by default.
§Custom messages
This macro has a second form, where a custom panic message can be provided with or without
arguments for formatting. See std::fmt for syntax for this form.
§Examples
let res: Poll<Result<i32, ()>> = Poll::Ready(Ok(42));
assert_ready_eq!(res, Ok(42));The contained value will also be returned from this macro call:
let res: Poll<Result<i32, ()>> = Poll::Ready(Ok(42));
let value = assert_ready_eq!(res, Ok(42));
assert_eq!(value, Ok(42));A Poll::Pending variant will panic:
ⓘ
let res: Poll<Result<i32, ()>> = Poll::Pending;
assert_ready_eq!(res, Ok(42)); // Will panic