tinystr crates.io Build Status Coverage Status

tinystr is a small ASCII-only bounded length string representation.

Usage

```rust use tinystr::{TinyStr4, TinyStr8};

fn main() { let s1: TinyStr4 = "tEsT".parse() .expect("Failed to parse.");

assert_eq!(s1, "tEsT");
assert_eq!(s1.to_ascii_uppercase(), "TEST");
assert_eq!(s1.to_ascii_lowercase(), "test");
assert_eq!(s1.to_ascii_titlecase(), "Test");
assert_eq!(s1.is_ascii_alphanumeric(), true);

let s2: TinyStr8 = "New York".parse()
    .expect("Failed to parse.");

assert_eq!(s2, "New York");
assert_eq!(s2.to_ascii_uppercase(), "NEW YORK");
assert_eq!(s2.to_ascii_lowercase(), "new york");
assert_eq!(s2.is_ascii_alphanumeric(), false);

} ```

Details

It provides two structs: * TinyStr4 an ASCII-only string limited to 4 characters. * TinyStr8 an ASCII-only string limited to 8 characters.

It performs a very tailored set of operations * toasciilowercase * toasciiuppercase * toasciititlecase (TinyStr4 only) * isasciialphanumeric

This set is sufficient for certain classes of uses such as unic-langid libraries.

Performance

For those uses, TinyStr provides performance characteristics much better than the regular String.

Status

The crate is fully functional and ready to be used in production. The capabilities can be extended.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.


Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Serde by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.