4 releases
new 0.2.0 | Apr 8, 2025 |
---|---|
0.1.3 | Oct 12, 2023 |
0.1.2 | Oct 7, 2023 |
0.1.1 |
|
0.1.0 | Oct 3, 2023 |
#406 in Rust patterns
1,422 downloads per month
Used in 2 crates
6KB
116 lines
Rust const &[u8]
and &str
concatenation
const NUM: i128 = 1;
// &str
const HELLO: &str = "Hello";
const RES: &str = concat_const::concat!(HELLO, "world", concat_const::int!(NUM));
assert_eq!(RES, "Helloworld1");
// bytes
const HELLO: &[u8] = b"Hello";
const RES: &[u8] = concat_const::concat_bytes!(HELLO, b"world", concat_const::int_bytes!(NUM));
assert_eq!(RES, b"Helloworld1");
Look at the tests for more usage examples