#![deny(missing_docs, unsafe_code)]
#![doc(html_logo_url = "https://unicode-rs.github.io/unicode-rs_sm.png",
html_favicon_url = "https://unicode-rs.github.io/unicode-rs_sm.png")]
pub use tables::UNICODE_VERSION;
pub use decompose::Decompositions;
pub use recompose::Recompositions;
use std::str::Chars;
mod decompose;
mod normalize;
mod recompose;
mod tables;
#[cfg(test)]
mod test;
#[cfg(test)]
mod testdata;
pub mod char {
pub use normalize::{decompose_canonical, decompose_compatible, compose};
pub use tables::normalization::canonical_combining_class;
pub use tables::normalization::is_combining_mark;
}
pub trait UnicodeNormalization<I: Iterator<Item=char>> {
#[inline]
fn nfd(self) -> Decompositions<I>;
#[inline]
fn nfkd(self) -> Decompositions<I>;
#[inline]
fn nfc(self) -> Recompositions<I>;
#[inline]
fn nfkc(self) -> Recompositions<I>;
}
impl<'a> UnicodeNormalization<Chars<'a>> for &'a str {
#[inline]
fn nfd(self) -> Decompositions<Chars<'a>> {
decompose::new_canonical(self.chars())
}
#[inline]
fn nfkd(self) -> Decompositions<Chars<'a>> {
decompose::new_compatible(self.chars())
}
#[inline]
fn nfc(self) -> Recompositions<Chars<'a>> {
recompose::new_canonical(self.chars())
}
#[inline]
fn nfkc(self) -> Recompositions<Chars<'a>> {
recompose::new_compatible(self.chars())
}
}
impl<I: Iterator<Item=char>> UnicodeNormalization<I> for I {
#[inline]
fn nfd(self) -> Decompositions<I> {
decompose::new_canonical(self)
}
#[inline]
fn nfkd(self) -> Decompositions<I> {
decompose::new_compatible(self)
}
#[inline]
fn nfc(self) -> Recompositions<I> {
recompose::new_canonical(self)
}
#[inline]
fn nfkc(self) -> Recompositions<I> {
recompose::new_compatible(self)
}
}