pub trait AsciiChars {
// Required methods
fn ascii_chars(&self) -> AsciiCharsIter<'_> ⓘ;
fn to_ascii_lossy(&self) -> String;
}
Expand description
Convenience functions for deunicode. use deunicode::AsciiChars
Required Methods§
Sourcefn ascii_chars(&self) -> AsciiCharsIter<'_> ⓘ
fn ascii_chars(&self) -> AsciiCharsIter<'_> ⓘ
Iterate over Unicode characters converted to ASCII sequences.
Items of this iterator may be None
for some characters.
Use .map(|ch| ch.unwrap_or("?"))
to replace invalid characters.
Alternatively, this iterator can be used in formatters:
use deunicode::AsciiChars;
format!("what's up {}", "🐶".ascii_chars());
Sourcefn to_ascii_lossy(&self) -> String
fn to_ascii_lossy(&self) -> String
Convert any Unicode string to ASCII-only string.
Characters are converted to closest ASCII equivalent.
Characters that can’t be converted are replaced with "[?]"
.