Skip to main content

func_bail

Macro func_bail 

macro_rules! func_bail {
    ($($arg:tt)*) => { ... };
}
Expand description

Return early from a #[func], creating an error value from a format string (including string literals).

Same principle as eyre::bail!, miette::bail!, and anyhow::bail!.

This macro expands to return Err(E::from(format!(...))), where E is inferred from the function’s return type. Accepts a string literal or a format!-style format string with arguments.

Works with any error type E that implements From<String>, e.g. strat::Unexpected.