Skip to main content

format_maybe

Macro format_maybe 

Source
macro_rules! format_maybe {
    ($s:literal $(,)?) => { ... };
    ($s:literal, $($args:tt)+) => { ... };
}
Expand description

Constant expression to bypass format! if the argument is a string literal but not a format string. If the literal is a format string then String is returned otherwise the input (i.e. &’static str) is returned. If multiple arguments are provided the first is assumed to be a format string.