Crates.io | azusa |
lib.rs | azusa |
version | 1.0.1 |
source | src |
created_at | 2023-10-31 14:57:11.417305 |
updated_at | 2023-10-31 15:01:47.214081 |
description | String index transformer for Rust utf8 to JavaScript utf16. |
homepage | https://github.com/xn-sakina/azusa |
repository | https://github.com/xn-sakina/azusa |
max_upload_size | |
id | 1019906 |
size | 21,613 |
Transform string index from UTF-8
in Rust to UTF-16
in JavsScript.
use azusa;
let text = "c😅é文";
let transformer = Azusa::new(text.into());
let utf8_range_in_rust = (1, 5);
let utf16_range_in_js = (1, 3);
assert_eq!(
transformer.utf8_to_utf16(utf8_range_in_rust),
utf16_range_in_js
);
// In javascript: text.slice(1, 3) === "😅"
MIT