Enum icu::properties::GeneralCategory
source · pub enum GeneralCategory {
Show 30 variants
Unassigned,
UppercaseLetter,
LowercaseLetter,
TitlecaseLetter,
ModifierLetter,
OtherLetter,
NonspacingMark,
SpacingMark,
EnclosingMark,
DecimalNumber,
LetterNumber,
OtherNumber,
SpaceSeparator,
LineSeparator,
ParagraphSeparator,
Control,
Format,
PrivateUse,
Surrogate,
DashPunctuation,
OpenPunctuation,
ClosePunctuation,
ConnectorPunctuation,
InitialPunctuation,
FinalPunctuation,
OtherPunctuation,
MathSymbol,
CurrencySymbol,
ModifierSymbol,
OtherSymbol,
}
Expand description
Enumerated property General_Category.
General_Category specifies the most general classification of a code point, usually determined based on the primary characteristic of the assigned character. For example, is the character a letter, a mark, a number, punctuation, or a symbol, and if so, of what type?
GeneralCategory only supports specific subcategories (eg UppercaseLetter
).
It does not support grouped categories (eg Letter
). For grouped categories, use GeneralCategoryGroup
.
Variants§
Unassigned
(Cn
) A reserved unassigned code point or a noncharacter
UppercaseLetter
(Lu
) An uppercase letter
LowercaseLetter
(Ll
) A lowercase letter
TitlecaseLetter
(Lt
) A digraphic letter, with first part uppercase
ModifierLetter
(Lm
) A modifier letter
OtherLetter
(Lo
) Other letters, including syllables and ideographs
NonspacingMark
(Mn
) A nonspacing combining mark (zero advance width)
SpacingMark
(Mc
) A spacing combining mark (positive advance width)
EnclosingMark
(Me
) An enclosing combining mark
DecimalNumber
(Nd
) A decimal digit
LetterNumber
(Nl
) A letterlike numeric character
OtherNumber
(No
) A numeric character of other type
SpaceSeparator
(Zs
) A space character (of various non-zero widths)
LineSeparator
(Zl
) U+2028 LINE SEPARATOR only
ParagraphSeparator
(Zp
) U+2029 PARAGRAPH SEPARATOR only
Control
(Cc
) A C0 or C1 control code
Format
(Cf
) A format control character
PrivateUse
(Co
) A private-use character
Surrogate
(Cs
) A surrogate code point
DashPunctuation
(Pd
) A dash or hyphen punctuation mark
OpenPunctuation
(Ps
) An opening punctuation mark (of a pair)
ClosePunctuation
(Pe
) A closing punctuation mark (of a pair)
ConnectorPunctuation
(Pc
) A connecting punctuation mark, like a tie
InitialPunctuation
(Pi
) An initial quotation mark
FinalPunctuation
(Pf
) A final quotation mark
OtherPunctuation
(Po
) A punctuation mark of other type
MathSymbol
(Sm
) A symbol of mathematical use
CurrencySymbol
(Sc
) A currency sign
ModifierSymbol
(Sk
) A non-letterlike modifier symbol
OtherSymbol
(So
) A symbol of other type
Implementations§
source§impl GeneralCategory
impl GeneralCategory
sourcepub fn get_name_to_enum_mapper(
provider: &impl DataProvider<GeneralCategoryNameToValueV1Marker>
) -> Result<PropertyValueNameToEnumMapper<GeneralCategory>, PropertiesError>
pub fn get_name_to_enum_mapper( provider: &impl DataProvider<GeneralCategoryNameToValueV1Marker> ) -> Result<PropertyValueNameToEnumMapper<GeneralCategory>, PropertiesError>
Return a PropertyValueNameToEnumMapper
, capable of looking up values
from strings for the General_Category
enumerated property
Example
use icu::properties::GeneralCategory;
let lookup = GeneralCategory::get_name_to_enum_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
// short name for value
assert_eq!(lookup.get_strict("Lu"), Some(GeneralCategory::UppercaseLetter));
assert_eq!(lookup.get_strict("Pd"), Some(GeneralCategory::DashPunctuation));
// long name for value
assert_eq!(lookup.get_strict("Uppercase_Letter"), Some(GeneralCategory::UppercaseLetter));
assert_eq!(lookup.get_strict("Dash_Punctuation"), Some(GeneralCategory::DashPunctuation));
// name has incorrect casing
assert_eq!(lookup.get_strict("dashpunctuation"), None);
// loose matching of name
assert_eq!(lookup.get_loose("dash-punctuation"), Some(GeneralCategory::DashPunctuation));
// fake property
assert_eq!(lookup.get_loose("Animated_Gif"), None);
sourcepub fn get_enum_to_short_name_mapper(
provider: &impl DataProvider<GeneralCategoryValueToShortNameV1Marker>
) -> Result<PropertyEnumToValueNameLinearMapper<GeneralCategory>, PropertiesError>
pub fn get_enum_to_short_name_mapper( provider: &impl DataProvider<GeneralCategoryValueToShortNameV1Marker> ) -> Result<PropertyEnumToValueNameLinearMapper<GeneralCategory>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up short names
for values of the General_Category
enumerated property
Example
use icu::properties::GeneralCategory;
let lookup = GeneralCategory::get_enum_to_short_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(GeneralCategory::UppercaseLetter), Some("Lu"));
assert_eq!(lookup.get(GeneralCategory::DashPunctuation), Some("Pd"));
sourcepub fn get_enum_to_long_name_mapper(
provider: &impl DataProvider<GeneralCategoryValueToLongNameV1Marker>
) -> Result<PropertyEnumToValueNameLinearMapper<GeneralCategory>, PropertiesError>
pub fn get_enum_to_long_name_mapper( provider: &impl DataProvider<GeneralCategoryValueToLongNameV1Marker> ) -> Result<PropertyEnumToValueNameLinearMapper<GeneralCategory>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up long names
for values of the General_Category
enumerated property
Example
use icu::properties::GeneralCategory;
let lookup = GeneralCategory::get_enum_to_long_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(GeneralCategory::UppercaseLetter), Some("Uppercase_Letter"));
assert_eq!(lookup.get(GeneralCategory::DashPunctuation), Some("Dash_Punctuation"));
Trait Implementations§
source§impl AsULE for GeneralCategory
impl AsULE for GeneralCategory
source§fn to_unaligned(self) -> <GeneralCategory as AsULE>::ULE
fn to_unaligned(self) -> <GeneralCategory as AsULE>::ULE
source§fn from_unaligned(other: <GeneralCategory as AsULE>::ULE) -> GeneralCategory
fn from_unaligned(other: <GeneralCategory as AsULE>::ULE) -> GeneralCategory
source§impl Clone for GeneralCategory
impl Clone for GeneralCategory
source§fn clone(&self) -> GeneralCategory
fn clone(&self) -> GeneralCategory
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for GeneralCategory
impl Debug for GeneralCategory
source§impl<'de> Deserialize<'de> for GeneralCategory
impl<'de> Deserialize<'de> for GeneralCategory
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<GeneralCategory, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<GeneralCategory, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl From<GeneralCategory> for GeneralCategoryGroup
impl From<GeneralCategory> for GeneralCategoryGroup
source§fn from(subcategory: GeneralCategory) -> GeneralCategoryGroup
fn from(subcategory: GeneralCategory) -> GeneralCategoryGroup
source§impl Ord for GeneralCategory
impl Ord for GeneralCategory
source§fn cmp(&self, other: &GeneralCategory) -> Ordering
fn cmp(&self, other: &GeneralCategory) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<GeneralCategory> for GeneralCategory
impl PartialEq<GeneralCategory> for GeneralCategory
source§fn eq(&self, other: &GeneralCategory) -> bool
fn eq(&self, other: &GeneralCategory) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<GeneralCategory> for GeneralCategory
impl PartialOrd<GeneralCategory> for GeneralCategory
source§fn partial_cmp(&self, other: &GeneralCategory) -> Option<Ordering>
fn partial_cmp(&self, other: &GeneralCategory) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl Serialize for GeneralCategory
impl Serialize for GeneralCategory
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
source§impl TrieValue for GeneralCategory
impl TrieValue for GeneralCategory
§type TryFromU32Error = &'static str
type TryFromU32Error = &'static str
source§fn try_from_u32(
i: u32
) -> Result<GeneralCategory, <GeneralCategory as TrieValue>::TryFromU32Error>
fn try_from_u32( i: u32 ) -> Result<GeneralCategory, <GeneralCategory as TrieValue>::TryFromU32Error>
u32
first.source§impl TryFrom<u8> for GeneralCategory
impl TryFrom<u8> for GeneralCategory
source§fn try_from(val: u8) -> Result<GeneralCategory, GeneralCategoryTryFromError>
fn try_from(val: u8) -> Result<GeneralCategory, GeneralCategoryTryFromError>
Construct this GeneralCategory
from an integer, returning
an error if it is out of bounds
source§impl<'a> ZeroMapKV<'a> for GeneralCategory
impl<'a> ZeroMapKV<'a> for GeneralCategory
§type Container = ZeroVec<'a, GeneralCategory>
type Container = ZeroVec<'a, GeneralCategory>
ZeroVec
] or [VarZeroVec
].type Slice = ZeroSlice<GeneralCategory>
§type OwnedType = GeneralCategory
type OwnedType = GeneralCategory
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