Struct Keywords
struct Keywords(_)
A list of Key-Value pairs representing functional information
about locale's internationalization preferences.
Here are examples of fields used in Unicode:
hc- Hour Cycle (h11,h12,h23,h24)ca- Calendar (buddhist,gregory, ...)fw- First Day Of the Week (sun,mon,sat, ...)
You can find the full list in Unicode BCP 47 U Extension section of LDML.
Examples
Manually build up a Keywords object:
use ;
let keywords =
.into_iter
.;
assert_eq!;
Access a Keywords object from a Locale:
use ;
let loc: Locale = "und-u-hc-h23-kc-true".parse.expect;
assert_eq!;
assert_eq!;
assert_eq!;
assert_eq!;
Implementations
impl Keywords
impl Keywords
const fn new() -> SelfReturns a new empty list of key-value pairs. Same as
default(), but isconst.Examples
use Keywords; assert_eq!;const fn new_single(key: Key, value: Value) -> SelfCreate a new list of key-value pairs having exactly one pair, callable in a
constcontext.fn is_empty(self: &Self) -> boolReturns
trueif there are no keywords.Examples
use locale; use Locale; let loc1 = try_from_str.unwrap; let loc2 = locale!; assert!; assert!;fn contains_key<Q>(self: &Self, key: &Q) -> bool where Key: Borrow<Q>, Q: OrdReturns
trueif the list contains aValuefor the specifiedKey.Examples
use ; let keywords = .into_iter .; assert!;fn get<Q>(self: &Self, key: &Q) -> Option<&Value> where Key: Borrow<Q>, Q: OrdReturns a reference to the
Valuecorresponding to theKey.Examples
use ; let keywords = .into_iter .; assert_eq!;fn clear(self: &mut Self) -> SelfClears all Unicode extension keywords, leaving Unicode attributes.
Returns the old Unicode extension keywords.
Examples
use Locale; let mut loc: Locale = "und-u-hello-ca-buddhist-hc-h12".parse.unwrap; loc.extensions.unicode.keywords.clear; assert_eq!;fn strict_cmp(self: &Self, other: &[u8]) -> OrderingCompare this
Keywordswith BCP-47 bytes.The return value is equivalent to what would happen if you first converted this
Keywordsto a BCP-47 string and then performed a byte comparison.This function is case-sensitive and results in a total order, so it is appropriate for binary search. The only argument producing
Ordering::Equalisself.to_string().Examples
use Locale; use Ordering; let bcp47_strings: & = &; for ab in bcp47_strings.windowsfn iter(self: &Self) -> impl Iterator<Item = (&Key, &Value)>Produce an ordered iterator over key-value pairs
impl Clone for Keywords
fn clone(self: &Self) -> Keywords
impl Debug for Keywords
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for Keywords
fn default() -> Keywords
impl Display for Keywords
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Eq for Keywords
impl Freeze for Keywords
impl From for Keywords
fn from(map: LiteMap<Key, Value, ShortBoxSlice<(Key, Value)>>) -> Self
impl Hash for Keywords
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl Ord for Keywords
fn cmp(self: &Self, other: &Keywords) -> Ordering
impl PartialEq for Keywords
fn eq(self: &Self, other: &Keywords) -> bool
impl PartialOrd for Keywords
fn partial_cmp(self: &Self, other: &Keywords) -> Option<Ordering>
impl RefUnwindSafe for Keywords
impl Send for Keywords
impl StructuralPartialEq for Keywords
impl Sync for Keywords
impl Unpin for Keywords
impl UnsafeUnpin for Keywords
impl UnwindSafe for Keywords
impl Writeable for Keywords
fn write_to<W: core::fmt::Write + ?Sized>(self: &Self, sink: &mut W) -> Resultfn writeable_length_hint(self: &Self) -> LengthHint
impl<T> Any for Keywords
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Keywords
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Keywords
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Keywords
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for Keywords
impl<T> From for Keywords
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Keywords
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> ToString for Keywords
fn to_string(self: &Self) -> String
impl<T, U> Into for Keywords
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Keywords
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Keywords
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>