| Crates.io | realhydroper-utf16 |
| lib.rs | realhydroper-utf16 |
| version | 1.1.0 |
| created_at | 2025-02-20 18:12:22.513513+00 |
| updated_at | 2025-02-20 18:12:22.513513+00 |
| description | Work with UTF-16 in Rust |
| homepage | |
| repository | https://github.com/realhydroper/rustutf16 |
| max_upload_size | |
| id | 1562936 |
| size | 38,210 |
Work with UTF-16 in Rust.
utf16string - realhydroper-utf16 uses code units as u16 instead of octets for indexing strings, as opposed to utf16string.Use the utils submodule for converting between offset encodings:
use realhydroper_utf16::{Utf16String, utils::*};
let utf8string = "a\u{10FFFF}b\u{10000}";
let utf16string = Utf16String::from(utf8string);
// (start: usize, end: usize)
assert_eq!(two_utf16_offsets_as_utf8_offsets(utf8string, &utf16string, 3, 4), (5, 6));
assert_eq!(two_utf8_offsets_as_utf16_offsets(&utf16string, utf8string, 5, 6), (3, 4));