1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
//! Small macros used internally. /// Bail out of the current function with the given error kind. #[macro_export] macro_rules! bail { ($kind:expr) => { return Err($kind.into()); }; } /// Ensure a condition holds, returning an error if it doesn't (ala `assert`). #[macro_export] macro_rules! ensure { ($cond:expr, $kind:expr) => { if !($cond) { return Err($kind.into()); } }; }