cluConstData 2.1.2

Compile-time macros for building persistent data structures in no_std and const environments. Supports buffer composition, and numeric formatting.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use cluConstData::concat_str;

#[test]
fn concat_str() {
	const H: &str = "H";
	const E: &str = "e";
	const L: &str = "l";
	const O: &str = "o";
	const RIGHT: &str = "!";

	const HELLO_WORLD: &str = concat_str!(H, E, L, L, O, " ", "World", RIGHT);

	assert!(core::str::from_utf8(HELLO_WORLD.as_bytes()).is_ok());
	assert_eq!(HELLO_WORLD, "Hello World!");
}