Struct icu_properties::props::EastAsianWidth
source · #[repr(transparent)]pub struct EastAsianWidth(pub u8);
Expand description
Enumerated property East_Asian_Width.
See “Definition” in UAX #11 for the summary of each property value: https://www.unicode.org/reports/tr11/#Definitions
The numeric value is compatible with UEastAsianWidth
in ICU4C.
Tuple Fields§
§0: u8
Implementations§
source§impl EastAsianWidth
impl EastAsianWidth
pub const Neutral: EastAsianWidth = _
pub const Ambiguous: EastAsianWidth = _
pub const Halfwidth: EastAsianWidth = _
pub const Fullwidth: EastAsianWidth = _
pub const Narrow: EastAsianWidth = _
pub const Wide: EastAsianWidth = _
source§impl EastAsianWidth
impl EastAsianWidth
sourcepub const fn name_to_enum_mapper() -> PropertyValueNameToEnumMapperBorrowed<'static, EastAsianWidth>
pub const fn name_to_enum_mapper() -> PropertyValueNameToEnumMapperBorrowed<'static, EastAsianWidth>
Return a PropertyValueNameToEnumMapper
, capable of looking up values
from strings for the East_Asian_Width
enumerated property.
✨ Enabled with the compiled_data
Cargo feature.
§Example
use icu::properties::EastAsianWidth;
let lookup = EastAsianWidth::name_to_enum_mapper();
// short name for value
assert_eq!(lookup.get_strict("N"), Some(EastAsianWidth::Neutral));
assert_eq!(lookup.get_strict("H"), Some(EastAsianWidth::Halfwidth));
// long name for value
assert_eq!(lookup.get_strict("Neutral"), Some(EastAsianWidth::Neutral));
assert_eq!(lookup.get_strict("Halfwidth"), Some(EastAsianWidth::Halfwidth));
// name has incorrect casing / extra hyphen
assert_eq!(lookup.get_strict("half-width"), None);
// loose matching of name
assert_eq!(lookup.get_loose("half-width"), Some(EastAsianWidth::Halfwidth));
// fake property
assert_eq!(lookup.get_strict("TwoPointFiveWidth"), None);
sourcepub fn get_name_to_enum_mapper(
provider: &(impl DataProvider<EastAsianWidthNameToValueV1Marker> + ?Sized),
) -> Result<PropertyValueNameToEnumMapper<EastAsianWidth>, PropertiesError>
pub fn get_name_to_enum_mapper( provider: &(impl DataProvider<EastAsianWidthNameToValueV1Marker> + ?Sized), ) -> Result<PropertyValueNameToEnumMapper<EastAsianWidth>, PropertiesError>
A version of EastAsianWidth::name_to_enum_mapper()
that uses custom data provided by a DataProvider
.
sourcepub const fn enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapperBorrowed<'static, EastAsianWidth>
pub const fn enum_to_short_name_mapper() -> PropertyEnumToValueNameLinearMapperBorrowed<'static, EastAsianWidth>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up short names
for values of the East_Asian_Width
enumerated property.
✨ Enabled with the compiled_data
Cargo feature.
§Example
use icu::properties::EastAsianWidth;
let lookup = EastAsianWidth::enum_to_short_name_mapper();
assert_eq!(lookup.get(EastAsianWidth::Neutral), Some("N"));
assert_eq!(lookup.get(EastAsianWidth::Halfwidth), Some("H"));
sourcepub fn get_enum_to_short_name_mapper(
provider: &(impl DataProvider<EastAsianWidthValueToShortNameV1Marker> + ?Sized),
) -> Result<PropertyEnumToValueNameLinearMapper<EastAsianWidth>, PropertiesError>
pub fn get_enum_to_short_name_mapper( provider: &(impl DataProvider<EastAsianWidthValueToShortNameV1Marker> + ?Sized), ) -> Result<PropertyEnumToValueNameLinearMapper<EastAsianWidth>, PropertiesError>
A version of EastAsianWidth::enum_to_short_name_mapper()
that uses custom data provided by a DataProvider
.
sourcepub const fn enum_to_long_name_mapper() -> PropertyEnumToValueNameLinearMapperBorrowed<'static, EastAsianWidth>
pub const fn enum_to_long_name_mapper() -> PropertyEnumToValueNameLinearMapperBorrowed<'static, EastAsianWidth>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up long names
for values of the East_Asian_Width
enumerated property.
✨ Enabled with the compiled_data
Cargo feature.
§Example
use icu::properties::EastAsianWidth;
let lookup = EastAsianWidth::enum_to_long_name_mapper();
assert_eq!(lookup.get(EastAsianWidth::Neutral), Some("Neutral"));
assert_eq!(lookup.get(EastAsianWidth::Halfwidth), Some("Halfwidth"));
sourcepub fn get_enum_to_long_name_mapper(
provider: &(impl DataProvider<EastAsianWidthValueToLongNameV1Marker> + ?Sized),
) -> Result<PropertyEnumToValueNameLinearMapper<EastAsianWidth>, PropertiesError>
pub fn get_enum_to_long_name_mapper( provider: &(impl DataProvider<EastAsianWidthValueToLongNameV1Marker> + ?Sized), ) -> Result<PropertyEnumToValueNameLinearMapper<EastAsianWidth>, PropertiesError>
A version of EastAsianWidth::enum_to_long_name_mapper()
that uses custom data provided by a DataProvider
.
Trait Implementations§
source§impl AsULE for EastAsianWidth
impl AsULE for EastAsianWidth
source§type ULE = EastAsianWidthULE
type ULE = EastAsianWidthULE
Self
. Read moresource§fn to_unaligned(self) -> Self::ULE
fn to_unaligned(self) -> Self::ULE
source§fn from_unaligned(unaligned: Self::ULE) -> Self
fn from_unaligned(unaligned: Self::ULE) -> Self
source§impl Clone for EastAsianWidth
impl Clone for EastAsianWidth
source§fn clone(&self) -> EastAsianWidth
fn clone(&self) -> EastAsianWidth
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for EastAsianWidth
impl Debug for EastAsianWidth
source§impl Hash for EastAsianWidth
impl Hash for EastAsianWidth
source§impl Ord for EastAsianWidth
impl Ord for EastAsianWidth
source§fn cmp(&self, other: &EastAsianWidth) -> Ordering
fn cmp(&self, other: &EastAsianWidth) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
source§impl PartialEq for EastAsianWidth
impl PartialEq for EastAsianWidth
source§impl PartialOrd for EastAsianWidth
impl PartialOrd for EastAsianWidth
source§impl TrieValue for EastAsianWidth
impl TrieValue for EastAsianWidth
source§type TryFromU32Error = TryFromIntError
type TryFromU32Error = TryFromIntError
source§fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
u32
first.source§impl<'a> ZeroMapKV<'a> for EastAsianWidth
impl<'a> ZeroMapKV<'a> for EastAsianWidth
source§type Container = ZeroVec<'a, EastAsianWidth>
type Container = ZeroVec<'a, EastAsianWidth>
ZeroVec
or VarZeroVec
.type Slice = ZeroSlice<EastAsianWidth>
source§type GetType = EastAsianWidthULE
type GetType = EastAsianWidthULE
Container::get()
Read moresource§type OwnedType = EastAsianWidth
type OwnedType = EastAsianWidth
Container::replace()
and Container::remove()
,
also used during deserialization. If Self
is human readable serialized,
deserializing to Self::OwnedType
should produce the same value once
passed through Self::owned_as_self()
Read moreimpl Copy for EastAsianWidth
impl Eq for EastAsianWidth
impl StructuralPartialEq for EastAsianWidth
Auto Trait Implementations§
impl Freeze for EastAsianWidth
impl RefUnwindSafe for EastAsianWidth
impl Send for EastAsianWidth
impl Sync for EastAsianWidth
impl Unpin for EastAsianWidth
impl UnwindSafe for EastAsianWidth
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
)