format_description!() { /* proc-macro */ }
Expand description

Equivalent of performing format_description::parse() at compile time.

Using the macro instead of the function results in a static slice rather than a Vec, such that it can be used in #![no_alloc] situations.

The resulting expression can be used in const or static declarations, and implements the sealed traits required for both formatting and parsing.

assert_eq!(
    format_description!("[hour]:[minute]:[second]"),
    format_description::parse("[hour]:[minute]:[second]")?
);
Run

The syntax accepted by this macro is the same as format_description::parse(), which can be found in the book.