Macro fail::fail_point
[−]
[src]
macro_rules! fail_point { ($name:expr) => { ... }; ($name:expr, $e:expr) => { ... }; ($name:expr, $cond:expr, $e:expr) => { ... }; }
The only entry to define a fail point.
When a fail point is defined, it's referenced via the full module path and name in the
format of crate::module::submodule::fail_point_name
. For example, library A defines
a fail point in lib.rs as follows:
pub fn f() { fail_point!("p1"); } mod my { pub fn f() { fail_point!("p2"); } }
The full name of the p1
fail point is A::p1
, and p2
is A::my::p2
.
$e
is used to transform a string to the return type of outer function or closure.
If you don't need to return early or a specified value, then you can use the
fail_point!($name)
.
If you provide an additional condition $cond
, then the condition will be evaluated
before the fail point is actually checked.