Skip to main content

const_concat_str

Macro const_concat_str 

Source
macro_rules! const_concat_str {
    ($($s:expr),* $(,)?) => { ... };
}
Expand description

Easily concatenate multiple const &str slices into a single const &str.

Unlike the concat! macro, which only works with string literals, this works with any const &str expressions.

ยงExample

use lexe_std::const_concat_str;

const NAME: &str = const_concat_str!("HUGE", " ", "MAN");
const GREETING: &str = const_concat_str!("Hello ", NAME, "!!");
assert_eq!(GREETING, "Hello HUGE MAN!!");