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
194 downloads per month
Used in utf8conv
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