Macro fomat_macros::fomat
[−]
[src]
macro_rules! fomat { (@cap ($len:expr, $multiplier:expr)) => { ... }; (@cap ($($lm:tt)*) for $p:pat in $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) sep $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) separated $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) if let $p:pat = $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) if $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) else $($tt:tt)*) => { ... }; (@cap ($($lm:tt)*) match $($tt:tt)*) => { ... }; (@cap ($len:expr, $mul:expr) ($($x:tt)*) $($rest:tt)*) => { ... }; (@cap ($len:expr, $mul:expr) [$($x:tt)*] $($rest:tt)*) => { ... }; (@cap ($len:expr, $mul:expr) {$($x:tt)*} $($rest:tt)*) => { ... }; (@cap ($len:expr, $mul:expr) $string:tt $($rest:tt)*) => { ... }; (@cap-ignore ($($lm:tt)*) { $($block:tt)* } $($rest:tt)*) => { ... }; (@cap-ignore ($($lm:tt)*) $tt:tt $($rest:tt)*) => { ... }; () => { ... }; ($($arg:tt)*) => { ... }; }
Creates a formatted string. Analogous to format!
.
See the crate root for general help on the syntax.
This macro returns String
containing the formatted text.
Panics
The macro will panic if formatting fails (which shoudn't happen for any
of std
types).
Examples
let v = [1, 2]; let s = fomat!("Hello, "[v]); assert_eq!(s, "Hello, [1, 2]"); let s = fomat!(for x in &v { (x*x) ";" }); assert_eq!(s, "1;4;");