5 releases (breaking)

0.5.0 Sep 19, 2022
0.4.0 Sep 17, 2022
0.3.0 Sep 11, 2022
0.2.0 Sep 11, 2022
0.1.0 Sep 10, 2022

#1639 in Development tools

Apache-2.0 OR MIT

9KB
107 lines

format_all_args macro

Formats any number of arguments without heap allocation.

Additionally, the library provides macro optional_arg which may be required when programming macros with optional arguments.

main.rs

use format_all_args::{format_all_args, optional_arg};

fn main() {
    macro_rules! optional_arg_test { ( $($a:expr)? ) => { optional_arg!($($a)?) }; }
    //                                 ----------^                      -----^
    //                                 optional                         optional
    //
    let result = format!("{}", format_all_args!(1,2,3,4,5,optional_arg_test!( ),7));
    assert_eq!(result, "123457");
}

No runtime deps