#utf-8 #width #length #character

no-std utf8-width

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

6 releases

0.1.5 Apr 22, 2021
0.1.4 Jul 29, 2020
0.1.3 Jun 27, 2020

#136 in Encoding

Download history 23300/week @ 2021-08-10 26437/week @ 2021-08-17 29442/week @ 2021-08-24 23181/week @ 2021-08-31 27250/week @ 2021-09-07 27998/week @ 2021-09-14 22689/week @ 2021-09-21 26970/week @ 2021-09-28 25851/week @ 2021-10-05 28519/week @ 2021-10-12 27030/week @ 2021-10-19 25096/week @ 2021-10-26 28824/week @ 2021-11-02 29180/week @ 2021-11-09 24880/week @ 2021-11-16 22688/week @ 2021-11-23

110,195 downloads per month
Used in 156 crates (5 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

extern crate utf8_width;

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

extern crate utf8_width;

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