Struct igpay_atinlay::IgpayAtinlay[][src]

pub struct IgpayAtinlay { /* fields omitted */ }

Transformer from text to Pig Latin.

Implementations

impl IgpayAtinlay[src]

pub fn new(vowel_suffix: &str, split_hyphens: bool) -> Self[src]

Create a new Pig Latin translator.

vowel_suffix is the string appended before “ay” after words beginning with a vowel: this is usually “w” or “h”, but also might be “j”, “” or any of a number of other things depending on the Pig Latin “dialect”.

Iff split_hyphens is true, treat hyphens as word boundaries.

pub fn word_to_pig_latin(&self, word: &str) -> String[src]

Transform word to Pig Latin. Word is assumed to be in a Romance language: see [IsRomanceVowel][IsRomanceVowel]::[is_romance_vowel][is_romance_vowel] for the definition of “vowel” used here. Leading non-alphabetic characters will be stripped, trailing will be preserved.

Examples

let pig = IgpayAtinlay::new("h", false);
assert_eq!(pig.word_to_pig_latin("Aye"), "Ayehay");
let pig = IgpayAtinlay::new("", false);
assert_eq!(pig.word_to_pig_latin("Aye"), "Ayeay");
let pig = IgpayAtinlay::new("w", false);
assert_eq!(pig.word_to_pig_latin("argle-bargle"), "argle-bargleway");
let pig = IgpayAtinlay::new("w", false);
assert_eq!(pig.word_to_pig_latin("ding-dong"), "ing-dongday");
assert_eq!(pig.word_to_pig_latin("*ding-dong*"), "ing-dong*day");

pub fn text_to_pig_latin(&self, text: &str) -> String[src]

Transform text to Pig Latin

Examples

let pig = IgpayAtinlay::new("h", false);
let pigtext=pig.text_to_pig_latin("Can't touch this! Awoo-away!");
assert_eq!(pigtext, "An'tcay ouchtay histay! Awoo-awayhay!");

Trait Implementations

impl Clone for IgpayAtinlay[src]

impl Debug for IgpayAtinlay[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.