#utf-8 #width #character #unicode-width #unicode-characters #length

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

#156 in Encoding

Download history 168940/week @ 2024-11-16 157648/week @ 2024-11-23 175582/week @ 2024-11-30 169188/week @ 2024-12-07 161934/week @ 2024-12-14 84996/week @ 2024-12-21 110268/week @ 2024-12-28 165708/week @ 2025-01-04 181333/week @ 2025-01-11 177652/week @ 2025-01-18 192031/week @ 2025-01-25 216495/week @ 2025-02-01 227611/week @ 2025-02-08 191854/week @ 2025-02-15 230196/week @ 2025-02-22 196857/week @ 2025-03-01

885,047 downloads per month
Used in 1,097 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