utf8-parser 0.0.4

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

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('🎄'));

Crate Features

  • std - Enables the std::error::Error implementation on Utf8ParserError
  • error_in_core - Same as std, but with core::error::Error. Currently requires Nightly and #![feature(error_in_core)]. Has no effect if the std feature is enabled.

Similar crates

License

Licensed under either of

at your option.