#[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§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 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 more