Skip to content

yuryshulaev/truncating-arraystring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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");
}

About

ArrayString wrapper with truncating Write

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages