1 unstable release
0.1.0 | Feb 8, 2023 |
---|
#17 in #data-structure
5KB
66 lines
truncating-arraystring
ArrayString wrapper with truncating Write.
use std::fmt::Write;
use truncating_arraystring::TruncatingArrayString;
fn main() {
let mut buf = TruncatingArrayString::<5>::new();
assert_eq!(write!(buf, "{}", "12"), Ok(()));
assert_eq!(write!(buf, "{}", "3456789"), Err(std::fmt::Error));
assert_eq!(&buf.0[..], "12345");
}
Dependencies
~69KB