Struct rust_icu_utrans::UTransliterator
source · [−]pub struct UTransliterator { /* private fields */ }
Expand description
Rust wrapper for the ICU UTransliterator
type.
Implementations
sourceimpl UTransliterator
impl UTransliterator
sourcepub fn get_ids() -> Result<Enumeration, Error>
pub fn get_ids() -> Result<Enumeration, Error>
Returns an enumeration containing the identifiers of all available transliterators.
Implements utrans_openIDs
.
sourcepub fn register(trans: Self) -> Result<(), Error>
pub fn register(trans: Self) -> Result<(), Error>
Consumes trans
and registers it with the underlying ICU system.
A transliterator that has been registered with the system can be
retrieved by calling new
with its identifier.
Implements utrans_register
.
sourcepub fn new(
id: &str,
rules: Option<&str>,
dir: UTransDirection
) -> Result<Self, Error>
pub fn new(
id: &str,
rules: Option<&str>,
dir: UTransDirection
) -> Result<Self, Error>
If rules are given, creates a new transliterator with rules and identifier. Otherwise, returns the ICU system transliterator with the given identifier.
Implements utrans_openU
.
sourcepub fn new_ustring(
id: &UChar,
rules: Option<&UChar>,
dir: UTransDirection
) -> Result<Self, Error>
pub fn new_ustring(
id: &UChar,
rules: Option<&UChar>,
dir: UTransDirection
) -> Result<Self, Error>
Implements utrans_openU
.
sourcepub fn get_id(&self) -> Result<String, Error>
pub fn get_id(&self) -> Result<String, Error>
Returns the identifier for this transliterator.
Implements utrans_getUnicodeID
.
sourcepub fn inverse(&self) -> Result<Self, Error>
pub fn inverse(&self) -> Result<Self, Error>
Returns the inverse of this transliterator, provided that the inverse
has been registered with the underlying ICU system, i.e., a built-in
ICU transliterator or one registered with register
.
Implements utrans_openInverse
.
sourcepub fn to_rules(&self, escape_unprintable: bool) -> Result<String, Error>
pub fn to_rules(&self, escape_unprintable: bool) -> Result<String, Error>
Returns a rules string for this transliterator in the same format
expected by new
.
Implements utrans_toRules
.
sourcepub fn set_filter(&mut self, pattern: Option<&str>) -> Result<(), Error>
pub fn set_filter(&mut self, pattern: Option<&str>) -> Result<(), Error>
Apply a filter to this transliterator, causing certain characters to
pass through untouched. The filter is formatted as a
UnicodeSet
string. If the filter is None
, then any previously-applied filter
is cleared.
Implements utrans_setFilter
.
sourcepub fn set_filter_ustring(
&mut self,
pattern: Option<&UChar>
) -> Result<(), Error>
pub fn set_filter_ustring(
&mut self,
pattern: Option<&UChar>
) -> Result<(), Error>
Implements utrans_setFilter
.
sourcepub fn transliterate(&self, text: &str) -> Result<String, Error>
pub fn transliterate(&self, text: &str) -> Result<String, Error>
Returns a string containing the transliterated text.
Implements utrans_transUChars
.
Trait Implementations
sourceimpl Clone for UTransliterator
impl Clone for UTransliterator
sourceimpl Debug for UTransliterator
impl Debug for UTransliterator
sourceimpl Drop for UTransliterator
impl Drop for UTransliterator
Auto Trait Implementations
impl RefUnwindSafe for UTransliterator
impl !Send for UTransliterator
impl !Sync for UTransliterator
impl Unpin for UTransliterator
impl UnwindSafe for UTransliterator
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more