#concatenation #const #string #byte

no-std concat_const

const &[u8] and &str concatenation

4 releases

new 0.2.0 Apr 8, 2025
0.1.3 Oct 12, 2023
0.1.2 Oct 7, 2023
0.1.1 Oct 7, 2023
0.1.0 Oct 3, 2023

#406 in Rust patterns

Download history 73/week @ 2024-12-29 173/week @ 2025-01-05 508/week @ 2025-01-12 202/week @ 2025-01-19 843/week @ 2025-01-26 927/week @ 2025-02-02 112/week @ 2025-02-09 89/week @ 2025-02-16 319/week @ 2025-02-23 366/week @ 2025-03-02 126/week @ 2025-03-09 667/week @ 2025-03-16 439/week @ 2025-03-23 91/week @ 2025-03-30 211/week @ 2025-04-06

1,422 downloads per month
Used in 2 crates

MIT/Apache

6KB
116 lines

Rust const &[u8] and &str concatenation

Crate API

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

No runtime deps