Skip to main content

rust_error

Macro rust_error 

Source
macro_rules! rust_error {
    ($($t:tt)*) => { ... };
}
Expand description

Collision-free alias for crate::error!.

Identical expansion and grammar (class = …, data = …, and the plain format! forms) — it exists so that use miniextendr_api::*; or use miniextendr_api::rust_error; gives you a usable macro name. The bare error! name is shadowed at the crate root by pub mod error (see the name-collision note on crate::error!), so a glob or direct import resolves to the module, not the macro. rust_error! has no such clash.

§Example

use miniextendr_api::rust_error;

#[miniextendr]
fn typed_fail(name: &str) {
    rust_error!(class = "my_error", "missing field: {name}");
}