| Crates.io | concat_const |
| lib.rs | concat_const |
| version | 0.2.0 |
| created_at | 2023-10-03 21:58:48.108887+00 |
| updated_at | 2025-04-08 19:21:17.531723+00 |
| description | const `&[u8]` and `&str` concatenation |
| homepage | |
| repository | https://github.com/RoDmitry/concat_const |
| max_upload_size | |
| id | 991595 |
| size | 5,198 |
&[u8] and &str concatenationconst 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