Struct Extensions
struct Extensions { ... }
A map of extensions associated with a given Locale.
Fields
unicode: UnicodeA representation of the data for a Unicode extension, when present in the locale identifier.
transform: TransformA representation of the data for a transform extension, when present in the locale identifier.
private: PrivateA representation of the data for a private-use extension, when present in the locale identifier.
other: &'static [Other]A sequence of any other extensions that are present in the locale identifier but are not formally defined and represented explicitly as
Unicode,Transform, andPrivateare.
Implementations
impl Extensions
const fn new() -> SelfReturns a new empty map of extensions. Same as
default(), but isconst.Examples
use Extensions; assert_eq!;const fn from_unicode(unicode: Unicode) -> SelfFunction to create a new map of extensions containing exactly one unicode extension, callable in
constcontext.fn is_empty(self: &Self) -> boolReturns whether there are no extensions present.
Examples
use Locale; let loc: Locale = "en-US-u-foo".parse.expect; assert!;fn total_cmp(self: &Self, other: &Self) -> OrderingReturns 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.
fn retain_by_type<F>(self: &mut Self, predicate: F) where F: FnMut(ExtensionType) -> boolRetains the specified extension types, clearing all others.
Examples
use ExtensionType; use Locale; let loc: Locale = "und-a-hello-t-mul-u-world-z-zzz-x-extra".parse.unwrap; let mut only_unicode = loc.clone; only_unicode .extensions .retain_by_type; assert_eq!; let mut only_t_z = loc.clone; only_t_z.extensions.retain_by_type; assert_eq!;
impl Clone for Extensions
fn clone(self: &Self) -> Extensions
impl Debug for Extensions
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl Default for Extensions
fn default() -> Extensions
impl Eq for Extensions
impl Freeze for Extensions
impl Hash for Extensions
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl PartialEq for Extensions
fn eq(self: &Self, other: &Extensions) -> bool
impl RefUnwindSafe for Extensions
impl Send for Extensions
impl StructuralPartialEq for Extensions
impl Sync for Extensions
impl Unpin for Extensions
impl UnsafeUnpin for Extensions
impl UnwindSafe for Extensions
impl<T> Any for Extensions
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Extensions
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Extensions
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Extensions
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> ErasedDestructor for Extensions
impl<T> From for Extensions
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Extensions
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for Extensions
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 Extensions
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Extensions
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>