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::locale::extensions::unicode::{key, value};
use icu::locale::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: KeywordsThe key-value pairs present in this locale extension, with each extension key subtag associated to its provided value subtag.
attributes: AttributesA canonically ordered sequence of single standalone subtags for this locale extension.
Implementations§
Source§impl Unicode
 
impl Unicode
Sourcepub fn try_from_str(s: &str) -> Result<Self, ParseError>
 
pub fn try_from_str(s: &str) -> Result<Self, ParseError>
A constructor which takes a str slice, parses it and
produces a well-formed Unicode.
Sourcepub fn try_from_utf8(code_units: &[u8]) -> Result<Self, ParseError>
 
pub fn try_from_utf8(code_units: &[u8]) -> Result<Self, ParseError>
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::locale::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§
Source§impl Display for Unicode
This trait is implemented for compatibility with fmt!.
To create a string, [Writeable::write_to_string] is usually more efficient.
 
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 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§impl<T> IntoEither for T
 
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
 
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
 
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more