macro_rules! str_concat {
($($x:expr),*) => { ... };
(str = $str:expr; $($x:expr),*) => { ... };
(cap = $cap:expr; $($x:expr),*) => { ... };
(sep = $sep:expr; $($x:expr),*) => { ... };
}
Expand description
Fast concat String
/ &str
/ number.
For details of params accepted, please refers to StringExtT
.
§Examples
// General usage
assert_eq!(
str_concat!(
NumStr::hex_default(0xa_usize), // HexStr
"b", // &str
"c".to_string(), // String
1u8, // single number
'😀', // char
'�' // char
), "abc1😀�"
);
// with initial string
assert_eq!(
str_concat!(str = "abc"; "1", "😀", "�"), "abc1😀�"
);
// with capacity
assert_eq!(
str_concat!(cap = 10; "abc", "1", "😀", "�"), "abc1😀�"
);
// with separator
assert_eq!(
str_concat!(sep = ","; "abc", "1", "😀", "�"), "abc,1,😀,�"
);