#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

#279 in No standard library

Download history 411/week @ 2024-07-14 223/week @ 2024-07-21 94/week @ 2024-07-28 141/week @ 2024-08-04 47/week @ 2024-08-11 64/week @ 2024-08-18 24/week @ 2024-08-25 122/week @ 2024-09-01 1/week @ 2024-09-08 64/week @ 2024-09-15 270/week @ 2024-09-22 208/week @ 2024-09-29 145/week @ 2024-10-06 1/week @ 2024-10-13 43/week @ 2024-10-20 3/week @ 2024-10-27

194 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