Skip to content

Rust const `&[u8]` and `&str` concatenation

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT
Notifications You must be signed in to change notification settings

RoDmitry/concat_const

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Rust const `&[u8]` and `&str` concatenation

Resources

License

Apache-2.0, MIT licenses found

Licenses found

Apache-2.0
LICENSE-APACHE
MIT
LICENSE-MIT

Stars

Watchers

Forks

Languages