5 个版本
0.2.1 | 2021 年 3 月 11 日 |
---|---|
0.2.0 | 2021 年 2 月 8 日 |
0.1.2 | 2021 年 2 月 6 日 |
0.1.1 | 2021 年 2 月 6 日 |
0.1.0 | 2021 年 2 月 6 日 |
1381 在 文本处理 分类中
每月 48 次下载
用于 3 个 crate
9KB
146 行
const-utf16
可用于 const 环境下的 utf8 到 utf16 转换函数。
使用
const HELLO_WORLD_UTF16: &[u16] = const_utf16::encode!("Hello, world!");
最低支持 Rust 版本 (MSRV)
由于使用了某些 const 表达式功能,此 crate 需要 Rust 1.46.0 或更高版本。
归属
此代码主要受到 Rust 核心库 utf16 转换代码的启发:Rust core utf16 conversion code。
lib.rs
:
Const 计算的 Utf8 到 Utf16 转换函数。
使用
const HELLO_WORLD_UTF16: &[u16] = const_utf16::encode!("Hello, world!");