azusa

Crates.ioazusa
lib.rsazusa
version1.0.1
sourcesrc
created_at2023-10-31 14:57:11.417305
updated_at2023-10-31 15:01:47.214081
descriptionString index transformer for Rust utf8 to JavaScript utf16.
homepagehttps://github.com/xn-sakina/azusa
repositoryhttps://github.com/xn-sakina/azusa
max_upload_size
id1019906
size21,613
咲奈Sakina (fz6m)

documentation

README

azusa

Transform string index from UTF-8 in Rust to UTF-16 in JavsScript.

Usage

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) === "😅"

License

MIT

Commit count: 4

cargo fmt