Crate stackfmt[][src]

Expand description

Creates formatted string from format_args!() like alloc::fmt::format() but without allocation:

let mut buf = [0u8; 64];
let formatted: &str = stackfmt::fmt_truncate(&mut buf, format_args!("Hello{}", 42));
assert_eq!(formatted, "Hello42");

Implemented based on this SO answer https://stackoverflow.com/a/50201632/601298

Structs

Impl of core::fmt::Write stream that writes formatted string into provided u8 buffer.

Functions

Writes formatted string into the buffer truncating if needed making the result valid utf8.