[][src]Macro mail_internals::ec_bail

macro_rules! ec_bail {
    (kind: $($tt:tt)*) => { ... };
    (mail_type: $mt:expr, kind: $($tt:tt)*) => { ... };
}

Macro for easier returning an EncodingError.

It will use the given input to create and EncodingError and return it (like try!/? returns an error, i.e. it places a return statement in the code).

Example

if failed_something() {
    // Note that the `mail_type: ...` part is not required and
    // `EncodingErrorKind` does _not_ need to be imported.
    ec_bail!(mail_type: MailType::Internationalized, kind: InvalidTextEncoding {
        expected_encoding: "utf-8",
        got_encoding: "utf-32"
    });
}