Macro claim::assert_err [−][src]
Asserts that expression returns Err(E)
variant.
Uses
Assertions are always checked in both debug and release builds, and cannot be disabled.
See debug_assert_err!
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: Result<i32, ()> = Err(()); assert_err!(res); // With custom messages assert_err!(res, "we are checking if there was an error with {:?}", res);
Ok(T)
variant will cause panic:
ⓘ
let res: Result<i32, ()> = Ok(42); assert_err!(res); // Will panic