concat_const

Crates.ioconcat_const
lib.rsconcat_const
version0.2.0
created_at2023-10-03 21:58:48.108887+00
updated_at2025-04-08 19:21:17.531723+00
descriptionconst `&[u8]` and `&str` concatenation
homepage
repositoryhttps://github.com/RoDmitry/concat_const
max_upload_size
id991595
size5,198
Dmitry Rodionov (RoDmitry)

documentation

https://docs.rs/concat_const/

README

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

Commit count: 25

cargo fmt