Crates.io | format_all_args |
lib.rs | format_all_args |
version | 0.5.0 |
source | src |
created_at | 2022-09-10 18:54:36.884931 |
updated_at | 2022-09-19 13:46:08.347818 |
description | Formats any number of arguments without heap allocation. |
homepage | |
repository | https://github.com/vglinka/format_all_args |
max_upload_size | |
id | 662661 |
size | 20,374 |
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");
}