Macro const_panic::concat_

source ·
macro_rules! concat_ {
    () => { ... };
    ($($args:tt)*) => { ... };
}
Available on crate feature non_basic only.
Expand description

Concatenates PanicFmt constants into a &'static str

This formats arguments the same as the concat_panic macro, also requiring the arguments to be constant expressions.

Example

Basic

use const_panic::concat_;

assert_eq!(concat_!("array: ", &[3u8, 5, 8, 13]), "array: [3, 5, 8, 13]");

Formatted

use const_panic::concat_;

assert_eq!(concat_!({?}: get_message(), {}: get_message()), r#""hello"hello"#);

const fn get_message() -> &'static str {
    "hello"
}