Macro format_xml::join
source · [−]macro_rules! join {
(move $sep:literal; $($e:expr),+) => { ... };
(move $sep:literal; $($e:expr),+; $s:literal) => { ... };
($sep:literal; $($e:expr),+) => { ... };
($sep:literal; $($e:expr),+; $s:literal) => { ... };
}
Expand description
Joins the arguments in a displayable object.
let result = fmtools::join!("--"; 1, 2.5, true).to_string();
assert_eq!(result, "1--2.5--true");
Optionally, the formatting can be specified:
let result = fmtools::join!("--"; 10, 11, 12; "{:#x}").to_string();
assert_eq!(result, "0xa--0xb--0xc");
The arguments can be captured by value and returned:
fn inner() -> impl std::fmt::Display {
let (a, b, c) = (1, 2.5, true);
return fmtools::join!(move "--"; a, b, c);
}
let result = inner().to_string();
assert_eq!(result, "1--2.5--true");