Macro aformat_into

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

aformat!, but you provide your own ArrayString.

The length of the ArrayString is checked at compile-time to fit all the arguments, although is not checked to be optimal.

§Usage

The first argument should be the identifier of the ArrayString, then the normal aformat! arguments follow.

§Examples

let mut out_buf = ArrayString::<32>::new();

let age = 18_u8;
aformat_into!(out_buf, "You are {} years old!", age);

assert_eq!(out_buf.as_str(), "You are 18 years old!");
// Buffer is too small, so compile failure!
let mut out_buf = ArrayString::<4>::new();

let age = 18_u8;
aformat_into!(out_buf, "You are {} years old!", age);