[][src]Struct translit::Transliterator

pub struct Transliterator { /* fields omitted */ }

The Transliterator struct allows for the transliteration of the string of characters of Cyrillic alphabet UTF-8 to Latin alphabet and back.

Methods

impl Transliterator[src]

pub fn new(custom_rules: CharsMapping) -> Self[src]

Creates a new Transliterator with transliteration table

Examples


use translit::{Transliterator, CharsMapping};
let table: CharsMapping =
[
("а", "a"),
("с", "s"),
("д", "d"),
("ф", "f"),
].iter()
  .cloned()
  .collect();

let trasliterator = Transliterator::new(table);
let res = trasliterator.convert("фасад", false);
assert_eq!("fasad", res);

pub fn convert(&self, src: &str, invert: bool) -> String[src]

Transliterate input string.

Trait Implementations

impl ToLatin for Transliterator[src]

fn to_latin(&self, src: &str) -> String[src]

The wrapper on the method convert of transliteration in the Latin alphabet

impl FromLatin for Transliterator[src]

fn from_latin(&self, src: &str) -> String[src]

The wrapper on the method convert of transliteration from the Latin alphabet

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]