Crate format_many

Crate format_many 

Source
Expand description

§format_many

This crate provides extended format_many! macro which allows formatting with variable number of argument inside one macro call.

This macro implemented using macro_rules! thus lightweight and IDE-friendly

use format_many::format_many;
 
let text: String = format_many!(
    "Hello {}", "World"
);
 
let text: String = format_many!(
    "Hello {}", "World";
    "Numbers {}, {}", 10, 11;
    "String literal";
    "Format {:?}", [1, 2, 3]
);

format_many! recieves a list of format strings with corresponding values separated by ;. Arguments in this inner lists are separated by ,.

Each argument separated by ; behaves like it’s own format! call, with compile-time checked number of arguments.

Macros§

format_many
Creates String using runtime concatenation of format! invocations with corectness checks at compile time.