| Crates.io | bidi |
| lib.rs | bidi |
| version | 0.1.1 |
| created_at | 2023-09-15 13:01:13.733487+00 |
| updated_at | 2023-09-16 08:19:39.60105+00 |
| description | Implementation of the Unicode Bidirectional Algorithm (UBA). |
| homepage | |
| repository | https://github.com/xclud/rust-bidi |
| max_upload_size | |
| id | 973656 |
| size | 2,093,906 |
Implementation of the Unicode Bidirectional Algorithm (UBA).
Reference: http://www.unicode.org/reports/tr9/.
Converts logical strings to their equivalent visual representation. Persian, Hebrew and Arabic languages (and any other RTL language) are supported.
use bidi:*;
let text: &str = "مهدی";
let mut text_u16 = text.encode_utf16().collect::<Vec<u16>>();
perform_shaping(&mut text_u16);
let result = String::from_utf16(text_u16.as_slice()).unwrap();
assert_eq!(result, "ﻣﻬﺪﯼ");