2 个版本
0.0.4 | 2023 年 12 月 16 日 |
---|---|
0.0.3 | 2023 年 12 月 14 日 |
#185 在 无标准库
20KB
350 行
utf8-parser
一个具有状态的、一次解析一个字节的 UTF-8 解析器。这适用于从 UART 读取的字节构建字符等情况。
示例
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('🎄'));
包功能
std
- 在Utf8ParserError
上启用 std::error::Error 实现error_in_core
- 与std
相同,但使用 core::error::Error。目前需要 Nightly 和#![feature(error_in_core)]
。如果启用了std
功能,则没有效果。
类似包
- utf8parse - 由 Alacritty 项目提供
许可证
根据您的选择,许可方式为
- Apache 许可证 2.0 版本,(LICENSE-APACHE)
- MIT 许可证 (LICENSE-MIT)
。