Crate utf8_parser

Source
Expand description

§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.

#![no_std] friendly

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.

Structs§

Utf8Parser
A stateful UTF-8 parser.

Enums§

Utf8ByteType
Categorization of a valid byte in UTF-8
Utf8ParserError
Error type used for the utf8-parser crate