| 200 | |
| 201 | #[pymethod] |
| 202 | fn is_normalized(&self, form: super::NormalizeForm, unistr: PyStrRef) -> PyResult<bool> { |
| 203 | let text = unistr.as_wtf8(); |
| 204 | let normalized: Wtf8Buf = match form { |
| 205 | Nfc => text.map_utf8(|s| s.nfc()).collect(), |
| 206 | Nfkc => text.map_utf8(|s| s.nfkc()).collect(), |
| 207 | Nfd => text.map_utf8(|s| s.nfd()).collect(), |
| 208 | Nfkd => text.map_utf8(|s| s.nfkd()).collect(), |
| 209 | }; |
| 210 | Ok(text == &*normalized) |
| 211 | } |
| 212 | |
| 213 | #[pymethod] |
| 214 | fn mirrored(&self, character: PyStrRef, vm: &VirtualMachine) -> PyResult<i32> { |