macro_rules! deku_error {
($p:path, $desc:expr, $fmt:expr, $($arg:expr),*) => { ... };
($p:path, $desc:expr, $fmt:expr) => { ... };
($p:path, $desc:expr) => { ... };
($p:path) => { ... };
}Expand description
Abstract over alloc vs no-alloc for handling of error strings
The macro takes the DekuError variant as an argument and performs the instantiation itself in order to cater to the no-alloc case where we discard all arguments beyond the description.
Invoked like:
use deku::{deku_error, DekuError};
let _ = deku_error!(DekuError::Parse,
"bit size is greater than input size",
"{} exceeds {}",
bit_size,
input_size);