#utf-8 #width #length #character

no-std utf8-width

To determine the width of a UTF-8 character by providing its first byte

7 releases

Uses new Rust 2021

0.1.6 Mar 19, 2022
0.1.5 Apr 22, 2021
0.1.4 Jul 29, 2020
0.1.3 Jun 27, 2020

#81 in Encoding

Download history 41608/week @ 2022-04-20 43374/week @ 2022-04-27 47104/week @ 2022-05-04 41309/week @ 2022-05-11 39498/week @ 2022-05-18 34464/week @ 2022-05-25 40818/week @ 2022-06-01 49408/week @ 2022-06-08 47311/week @ 2022-06-15 52410/week @ 2022-06-22 49665/week @ 2022-06-29 55874/week @ 2022-07-06 57554/week @ 2022-07-13 54279/week @ 2022-07-20 56181/week @ 2022-07-27 57146/week @ 2022-08-03

235,616 downloads per month
Used in 255 crates (6 directly)

MIT license

4KB
60 lines

UTF-8 Width

CI

To determine the width of a UTF-8 character by providing its first byte.

References: https://tools.ietf.org/html/rfc3629

Examples

assert_eq!(1, utf8_width::get_width(b'1'));
assert_eq!(3, utf8_width::get_width("".as_bytes()[0]));

Benchmark

cargo bench

Crates.io

https://crates.io/crates/utf8-width

Documentation

https://docs.rs/utf8-width

License

MIT


lib.rs:

UTF-8 Width

To determine the width of a UTF-8 character by providing its first byte.

References: https://tools.ietf.org/html/rfc3629

Examples

assert_eq!(1, utf8_width::get_width(b'1'));
assert_eq!(3, utf8_width::get_width("".as_bytes()[0]));

Benchmark

cargo bench

No runtime deps