pub struct Unicode {
pub keywords: Keywords,
pub attributes: Attributes,
}
Expand description
Unicode Extensions provide information about user preferences in a given locale.
A list of Unicode BCP47 U Extensions
as defined in Unicode Locale Identifier
specification.
Unicode extensions provide subtags that specify language and/or locale-based behavior
or refinements to language tags, according to work done by the Unicode Consortium.
(See RFC 6067
for details).
Examples
use icu::locid::Locale;
use icu::locid::{
extensions_unicode_key as key, extensions_unicode_value as value,
};
let loc: Locale =
"de-u-hc-h12-ca-buddhist".parse().expect("Parsing failed.");
assert_eq!(
loc.extensions.unicode.keywords.get(&key!("ca")),
Some(&value!("buddhist"))
);
Fields
keywords: Keywords
The key-value pairs present in this locale extension, with each extension key subtag associated to its provided value subtag.
attributes: Attributes
A canonically ordered sequence of single standalone subtags for this locale extension.
Implementations
sourceimpl Unicode
impl Unicode
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears all Unicode extension keywords and attributes, effectively removing the Unicode extension.
Example
use icu::locid::Locale;
let mut loc: Locale =
"und-t-mul-u-hello-ca-buddhist-hc-h12".parse().unwrap();
loc.extensions.unicode.clear();
assert_eq!(loc, "und-t-mul".parse().unwrap());
Trait Implementations
sourceimpl Display for Unicode
impl Display for Unicode
This trait is implemented for compatibility with fmt!
.
To create a string, [Writeable::write_to_string
] is usually more efficient.
sourceimpl Ord for Unicode
impl Ord for Unicode
sourceimpl PartialOrd<Unicode> for Unicode
impl PartialOrd<Unicode> for Unicode
sourcefn partial_cmp(&self, other: &Unicode) -> Option<Ordering>
fn partial_cmp(&self, other: &Unicode) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
sourceimpl Writeable for Unicode
impl Writeable for Unicode
sourcefn write_to<W>(&self, sink: &mut W) -> Result<(), Error> where
W: Write + ?Sized,
fn write_to<W>(&self, sink: &mut W) -> Result<(), Error> where
W: Write + ?Sized,
Writes a string to the given sink. Errors from the sink are bubbled up.
The default implementation delegates to write_to_parts
, and discards any
Part
annotations. Read more
sourcefn writeable_length_hint(&self) -> LengthHint
fn writeable_length_hint(&self) -> LengthHint
Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
sourcefn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error> where
S: PartsWrite + ?Sized,
fn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error> where
S: PartsWrite + ?Sized,
Write bytes and Part
annotations to the given sink. Errors from the
sink are bubbled up. The default implementation delegates to write_to
,
and doesn’t produce any Part
annotations. Read more
sourcefn write_to_string(&self) -> Cow<'_, str>
fn write_to_string(&self) -> Cow<'_, str>
Creates a new String
with the data from this Writeable
. Like ToString
,
but smaller and faster. Read more
impl Eq for Unicode
impl StructuralEq for Unicode
impl StructuralPartialEq for Unicode
Auto Trait Implementations
impl RefUnwindSafe for Unicode
impl Send for Unicode
impl Sync for Unicode
impl Unpin for Unicode
impl UnwindSafe for Unicode
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> Separable for T where
T: Display,
impl<T> Separable for T where
T: Display,
sourcefn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
Adds separators according to the given SeparatorPolicy
. Read more
sourcefn separate_with_commas(&self) -> String
fn separate_with_commas(&self) -> String
Inserts a comma every three digits from the right. Read more
sourcefn separate_with_spaces(&self) -> String
fn separate_with_spaces(&self) -> String
Inserts a space every three digits from the right. Read more
sourcefn separate_with_dots(&self) -> String
fn separate_with_dots(&self) -> String
Inserts a period every three digits from the right. Read more
sourcefn separate_with_underscores(&self) -> String
fn separate_with_underscores(&self) -> String
Inserts an underscore every three digits from the right. 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