uast 7.0.2

Unicode Aware Saṃskṛta Transliteration in Rust 🦀
Documentation
//! देवनागरी to ગુજરાતી

use crate::utils::{binary_search, split_line_and_convert};

static CHAR_DICT: [(char, char); 80] = [
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('ि', 'િ'),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
    ('', ''),
];

fn get_char(c: char) -> Option<char> {
    binary_search(&CHAR_DICT, c, |i| i)
}

fn convertor(dn: &str) -> String {
    dn.chars().filter_map(get_char).collect()
}

/// This function converts देवनागरी to ગુજરાતી.
///
/// ```
/// use uast::devanāgarī_to_gujarātī;
///
/// let s = "ॐ भूर्भुवः स्वः तत्सवितुर्वरेण्यं भर्गो देवस्य धीमहि। धियो यो नः प्रचोदयात्॥";
/// assert_eq!(
///     "ૐ ભૂર્ભુવઃ સ્વઃ તત્સવિતુર્વરેણ્યં ભર્ગો દેવસ્ય ધીમહિ। ધિયો યો નઃ પ્રચોદયાત્॥",
///     devanāgarī_to_gujarātī(&s)
/// );
/// ```
pub fn devanāgarī_to_gujarātī(dn: &str) -> String {
    split_line_and_convert(convertor, dn)
}