#utf-8 #width #character #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

#146 in Encoding

Download history 139092/week @ 2024-01-28 135001/week @ 2024-02-04 128624/week @ 2024-02-11 122061/week @ 2024-02-18 121287/week @ 2024-02-25 138437/week @ 2024-03-03 138166/week @ 2024-03-10 165905/week @ 2024-03-17 166301/week @ 2024-03-24 146688/week @ 2024-03-31 152288/week @ 2024-04-07 137826/week @ 2024-04-14 155255/week @ 2024-04-21 136931/week @ 2024-04-28 139541/week @ 2024-05-05 128301/week @ 2024-05-12

571,815 downloads per month
Used in 774 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