Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/property404/utf8-parser
Parse UTF-8 one byte at a time
https://github.com/property404/utf8-parser
Last synced: 27 days ago
JSON representation
Parse UTF-8 one byte at a time
- Host: GitHub
- URL: https://github.com/property404/utf8-parser
- Owner: Property404
- License: apache-2.0
- Created: 2023-11-17T22:04:43.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-26T15:45:12.000Z (9 months ago)
- Last Synced: 2024-04-27T04:41:38.981Z (8 months ago)
- Language: Rust
- Size: 34.2 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.APACHE
Awesome Lists containing this project
README
# 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](https://img.shields.io/badge/github-utf8--parser-/)](https://github.com/Property404/utf8-parser)
[![crates.io](https://img.shields.io/crates/v/utf8-parser.svg)](https://crates.io/crates/utf8-parser)
[![Documentation](https://docs.rs/utf8-parser/badge.svg)](https://docs.rs/utf8-parser)## Example
```rust
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
* [utf8parse](https://crates.io/crates/utf8parse) - by the Alacritty project
## License
Licensed under either of
* Apache License, Version 2.0, ([LICENSE-APACHE](https://www.apache.org/licenses/LICENSE-2.0))
* MIT license ([LICENSE-MIT](https://opensource.org/licenses/MIT))at your option.