#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

#143 in Encoding

Download history 54243/week @ 2023-12-23 79842/week @ 2023-12-30 104669/week @ 2024-01-06 114453/week @ 2024-01-13 121174/week @ 2024-01-20 135815/week @ 2024-01-27 137180/week @ 2024-02-03 128983/week @ 2024-02-10 121018/week @ 2024-02-17 121787/week @ 2024-02-24 137018/week @ 2024-03-02 138912/week @ 2024-03-09 163015/week @ 2024-03-16 167854/week @ 2024-03-23 147699/week @ 2024-03-30 130546/week @ 2024-04-06

633,142 downloads per month
Used in 714 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