format_all_args

Crates.ioformat_all_args
lib.rsformat_all_args
version0.5.0
sourcesrc
created_at2022-09-10 18:54:36.884931
updated_at2022-09-19 13:46:08.347818
descriptionFormats any number of arguments without heap allocation.
homepage
repositoryhttps://github.com/vglinka/format_all_args
max_upload_size
id662661
size20,374
Vadim G. (vglinka)

documentation

README

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");
}
Commit count: 5

cargo fmt