macro_rules! cconcat {
() => { ... };
($body:expr) => { ... };
($( $body:expr ),* $(,)?) => { ... };
}Expand description
Macro for creating Concats
§Note
When passing in 1 argument, it needs to be an iterator of sections (such as a Vec<Code>).
This variant is the same as calling into() or Concat::from().
For 2 or more arguments, they are concatenated into a new Concat instance.
§Examples
use codize::{cblock, cconcat};
let expected = r"fn main() {
foo();
}
fn foo() {
bar();
}";
let code = cconcat![
cblock!("fn main() {", [
"foo();",
], "}"),
"",
cblock!("fn foo() {", [
"bar();",
], "}")
];
assert_eq!(expected, code.to_string());