pub struct PropertyEnumToValueNameLinearMapper<T> {
map: DataPayload<ErasedEnumToValueNameLinearMapV1Marker>,
markers: PhantomData<fn(_: T)>,
}
Expand description
A struct capable of looking up a property name from a value
Access its data by calling Self::as_borrowed()
and using the methods on
PropertyEnumToValueNameLinearMapperBorrowed
.
This mapper is used for properties with sequential values, like GeneralCategory
.
It may be obtained using methods like GeneralCategory::get_enum_to_long_name_mapper()
.
The name returned may be a short ("Lu"
) or long ("Uppercase_Letter"
) name, depending
on the constructor used.
§Example
use icu::properties::GeneralCategory;
let lookup = GeneralCategory::enum_to_long_name_mapper();
assert_eq!(
lookup.get(GeneralCategory::UppercaseLetter),
Some("Uppercase_Letter")
);
assert_eq!(
lookup.get(GeneralCategory::DashPunctuation),
Some("Dash_Punctuation")
);
Fields§
§map: DataPayload<ErasedEnumToValueNameLinearMapV1Marker>
§markers: PhantomData<fn(_: T)>
Implementations§
source§impl<T: TrieValue> PropertyEnumToValueNameLinearMapper<T>
impl<T: TrieValue> PropertyEnumToValueNameLinearMapper<T>
sourcepub fn as_borrowed(&self) -> PropertyEnumToValueNameLinearMapperBorrowed<'_, T>
pub fn as_borrowed(&self) -> PropertyEnumToValueNameLinearMapperBorrowed<'_, T>
Construct a borrowed version of this type that can be queried.
This avoids a potential small underlying cost per API call (like get_static()
) by consolidating it
up front.
sourcepub(crate) fn from_data<M>(data: DataPayload<M>) -> Selfwhere
M: DataMarker<Yokeable = PropertyEnumToValueNameLinearMapV1<'static>>,
pub(crate) fn from_data<M>(data: DataPayload<M>) -> Selfwhere
M: DataMarker<Yokeable = PropertyEnumToValueNameLinearMapV1<'static>>,
Construct a new one from loaded data
Typically it is preferable to use methods on individual property value types
(like [Script::TBD()
]) instead.