[−][src]Trait pinyin::ToPinyinMulti
用于获取多音字信息的trait
仅在启用 heteronym
特性时可用
Associated Types
type Output
Required methods
fn to_pinyin_multi(&self) -> Self::Output
Implementations on Foreign Types
impl ToPinyinMulti for char
[src]
use pinyin::{Pinyin, ToPinyinMulti}; let mut iter = '还'.to_pinyin_multi().unwrap().into_iter(); let mut next_pinyin = || iter.next().map(Pinyin::with_tone); assert_eq!(next_pinyin(), Some("hái")); assert_eq!(next_pinyin(), Some("fú")); assert_eq!(next_pinyin(), Some("huán")); assert_eq!(next_pinyin(), None);
type Output = Option<PinyinMulti>
fn to_pinyin_multi(&self) -> Option<PinyinMulti>
[src]
impl<'a> ToPinyinMulti for &'a str
[src]
use pinyin::{Pinyin, ToPinyinMulti}; let mut iter = "还没".to_pinyin_multi(); let mut next_heteronym = || { iter.next() .and_then(|m| m) .map(|m| m.into_iter().map(Pinyin::with_tone).collect::<Vec<_>>()) }; assert_eq!(next_heteronym(), Some(vec!["hái", "fú", "huán"])); assert_eq!(next_heteronym(), Some(vec!["méi", "mò", "me"])); assert_eq!(next_heteronym(), None);