Struct icu_locid::extensions::unicode::Unicode
source · 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::extensions::unicode::{key, value};
use icu::locid::Locale;
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§
source§impl 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());
pub(crate) fn as_tuple(&self) -> (&Attributes, &Keywords)
sourcepub fn total_cmp(&self, other: &Self) -> Ordering
pub fn total_cmp(&self, other: &Self) -> Ordering
Returns an ordering suitable for use in BTreeSet
.
The ordering may or may not be equivalent to string ordering, and it may or may not be stable across ICU4X releases.
pub(crate) fn try_from_iter( iter: &mut SubtagIterator<'_>, ) -> Result<Self, ParserError>
pub(crate) fn for_each_subtag_str<E, F>(&self, f: &mut F) -> Result<(), E>
Trait Implementations§
source§impl 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.
source§impl Ord for Unicode
impl Ord for Unicode
source§impl PartialOrd for Unicode
impl PartialOrd for Unicode
source§impl Writeable for Unicode
impl Writeable for Unicode
source§fn write_to<W: Write + ?Sized>(&self, sink: &mut W) -> Result
fn write_to<W: Write + ?Sized>(&self, sink: &mut W) -> Result
write_to_parts
, and discards any
Part
annotations.source§fn writeable_length_hint(&self) -> LengthHint
fn writeable_length_hint(&self) -> LengthHint
source§fn 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,
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.impl Eq for Unicode
impl StructuralPartialEq for Unicode
Auto Trait Implementations§
impl Freeze for Unicode
impl RefUnwindSafe for Unicode
impl Send for Unicode
impl Sync for Unicode
impl Unpin for Unicode
impl UnwindSafe for Unicode
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)