#utf-8 #width #length #character

no-std utf8-width

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

8 releases

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

#89 in Encoding

Download history 87822/week @ 2023-08-20 84473/week @ 2023-08-27 83671/week @ 2023-09-03 89341/week @ 2023-09-10 88471/week @ 2023-09-17 86226/week @ 2023-09-24 86696/week @ 2023-10-01 86575/week @ 2023-10-08 87303/week @ 2023-10-15 88323/week @ 2023-10-22 90477/week @ 2023-10-29 94418/week @ 2023-11-05 100253/week @ 2023-11-12 89450/week @ 2023-11-19 100508/week @ 2023-11-26 90415/week @ 2023-12-03

388,585 downloads per month
Used in 598 crates (8 directly)

MIT license

5KB
59 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