#utf-8

no-std utf8-parser

A one-byte-at-a-time UTF-8 parser

3 unstable releases

0.1.0 Oct 11, 2024
0.0.4 Dec 16, 2023
0.0.3 Dec 14, 2023

#112 in No standard library

Download history 8/week @ 2024-07-01 20/week @ 2024-07-29 1/week @ 2024-09-23 3/week @ 2024-09-30 132/week @ 2024-10-07 22/week @ 2024-10-14

158 downloads per month

MIT/Apache

19KB
349 lines

utf8-parser

A stateful one-byte-at-a-time UTF-8 parser. This is useful for things like building characters from bytes pulled from a UART.

Repository crates.io Documentation

Example

use utf8_parser::Utf8Parser;

let mut parser = Utf8Parser::new();
assert!(parser.push(0xf0).unwrap().is_none());
assert!(parser.push(0x9f).unwrap().is_none());
assert!(parser.push(0x8e).unwrap().is_none());
assert_eq!(parser.push(0x84).unwrap(), Some('🎄'));

Similar crates

License

Licensed under either of

at your option.

No runtime deps