macro_rules! concat_string { () => { ... }; ($($s:expr),+) => { ... }; }
Expand description
Concatenates a series of string slices into an owned string.
This macro accepts zero or more arguments, where each argument implements AsRef<str>
, and
efficiently combines their string representations into a String
in order of declaration.
This is mainly useful for cases where the cost of parsing a format string outweighs the cost
of converting its arguments. Because concat_string
avoids format strings entirely, it can
achieve a higher level of performance than using format!
or other formatting utilities that
return a String
.
ยงExample
#[macro_use(concat_string)]
extern crate concat_string;
fn main() {
println!("{}", concat_string!("Hello", String::from(" "), "world"));
}