#format #stack #formatted #string #alloc #write #buffer

no-std stackfmt

Write formatted string to a buffer without alloc

3 releases

0.1.2 Nov 12, 2021
0.1.1 Jul 20, 2021
0.1.0 Jul 19, 2021

#370 in No standard library

Download history 3/week @ 2024-11-29 22/week @ 2024-12-06 31/week @ 2024-12-13 49/week @ 2024-12-20 26/week @ 2024-12-27 65/week @ 2025-01-03 114/week @ 2025-01-10 56/week @ 2025-01-17 28/week @ 2025-01-24 119/week @ 2025-01-31 70/week @ 2025-02-07 50/week @ 2025-02-14 200/week @ 2025-02-21 251/week @ 2025-02-28 200/week @ 2025-03-07

714 downloads per month
Used in utf8conv

MIT license

9KB
140 lines

stackfmt

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


lib.rs:

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

No runtime deps