panic_builder

Macro panic_builder 

Source
macro_rules! panic_builder {
    ($message:ident, $([$($arg:tt)+]),* $(,)?) => { ... };
}
Expand description

A macro for creating a panic message with placeholders for arguments. The message is formatted with the arguments and then a panic is raised.

ยงExample

use local_fmt::{panic_builder, gen_static_message};

const _: () = {
    let message = gen_static_message!("Error: {0} {1} {2}");
    // panic_builder!(message, ["This"], ["is"], ["a test"]);
};
error[E0080]: evaluation of constant value failed
 --> local-fmt/src/utils.rs:103:5
  |
9 |     panic_builder!(message, ["This"], ["is"], ["a test"]);
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the evaluated program panicked at 'Error: This is a test', local-fmt/src/utils.rs:9:5
  |