truncating-arraystring

Crates.iotruncating-arraystring
lib.rstruncating-arraystring
version0.1.0
sourcesrc
created_at2023-02-08 17:00:57.133827
updated_at2023-02-08 17:00:57.133827
descriptionArrayString wrapper with truncating Write
homepage
repositoryhttps://github.com/yuryshulaev/truncating-arraystring
max_upload_size
id779976
size4,128
Yury Shulaev (yuryshulaev)

documentation

README

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");
}
Commit count: 1

cargo fmt