Macro borked::borked[][src]

macro_rules! borked {
    ($message : expr) => { ... };
    ($message : expr, $cause : expr) => { ... };
    (TY => $new_err : ident) => { ... };
    (TY => $new_err : ident, $cause : expr) => { ... };
    (TY => $new_err : ident, C => $cause : ident, $($field : ident : $val : expr),
 *) => { ... };
}
Expand description

Macro for instantly returning a Result<_, Bork>.

Usage:

There is multiple ways to use this macro:

  • borked!("Message about Error") Creates a BaseBork where the messsage specified is returned as the name.
  • borked!("Message", cause) Where message is the same as above, and The cause is the Error/Bork that ‘caused’ this one. The caused message will be returned by the cause fn.
  • borked!(TY => Error_Type) Here the TY => must be put in exactly as seen, but the Error_Type is the identifier of the type you would like to be returned as a Bork.
  • borked!(TY => ErrorType, cause) same as above, but now with a cause. cause must be an actual instantiation and not just an identifier, like ErrorType.
  • borked!(TY => ErrorType, C => cause, field0:val, field1:val, ...) Here ErrorType and cause are the same as above, but the remainder of the arguments are the names of fields in the ErrorType, and the val’s are the values to set those fields to.