Struct icu_properties::runtime::UnicodeProperty

source ·
pub struct UnicodeProperty(pub u32);
Expand description

This type can represent any Unicode property.

This is intended to be used in situations where the exact unicode property needed is only known at runtime, for example in regex engines.

The values are intended to be identical to ICU4C’s UProperty enum

Tuple Fields§

§0: u32

Implementations§

source§

impl UnicodeProperty

source

pub const Alphabetic: Self = _

Binary property Alphabetic

source

pub const AsciiHexDigit: Self = _

Binary property ASCII_Hex_Digit

source

pub const BidiControl: Self = _

Binary property Bidi_Control

source

pub const BidiMirrored: Self = _

Binary property Bidi_Mirrored

source

pub const Dash: Self = _

Binary property Dash

source

pub const DefaultIgnorableCodePoint: Self = _

Binary property Default_Ignorable_Code_Point

source

pub const Deprecated: Self = _

Binary property Deprecated

source

pub const Diacritic: Self = _

Binary property Diacritic

source

pub const Extender: Self = _

Binary property Extender

source

pub const FullCompositionExclusion: Self = _

Binary property Full_Composition_Exclusion

source

pub const GraphemeBase: Self = _

Binary property Grapheme_Base

source

pub const GraphemeExtend: Self = _

Binary property Grapheme_Extend

Binary property Grapheme_Link

source

pub const HexDigit: Self = _

Binary property Hex_Digit

source

pub const Hyphen: Self = _

Binary property Hyphen

source

pub const IdContinue: Self = _

Binary property ID_Continue

source

pub const IdStart: Self = _

Binary property ID_Start

source

pub const Ideographic: Self = _

Binary property Ideographic

source

pub const IdsBinaryOperator: Self = _

Binary property IDS_Binary_Operator

source

pub const IdsTrinaryOperator: Self = _

Binary property IDS_Trinary_Operator

source

pub const JoinControl: Self = _

Binary property Join_Control

source

pub const LogicalOrderException: Self = _

Binary property Logical_Order_Exception

source

pub const Lowercase: Self = _

Binary property Lowercase

source

pub const Math: Self = _

Binary property Math

source

pub const NoncharacterCodePoint: Self = _

Binary property Noncharacter_Code_Point

source

pub const QuotationMark: Self = _

Binary property Quotation_Mark

source

pub const Radical: Self = _

Binary property Radical

source

pub const SoftDotted: Self = _

Binary property Soft_Dotted

source

pub const TerminalPunctuation: Self = _

Binary property Terminal_Punctuation

source

pub const UnifiedIdeograph: Self = _

Binary property Unified_Ideograph

source

pub const Uppercase: Self = _

Binary property Uppercase

source

pub const WhiteSpace: Self = _

Binary property White_Space

source

pub const XidContinue: Self = _

Binary property XID_Continue

source

pub const XidStart: Self = _

Binary property XID_Start

source

pub const CaseSensitive: Self = _

Binary property Case_Sensitive

source

pub const SentenceTerminal: Self = _

Binary property Sentence_Terminal

source

pub const VariationSelector: Self = _

Binary property Variation_Selector

source

pub const NfdInert: Self = _

Binary property NFD_Inert

source

pub const NfkdInert: Self = _

Binary property NFKD_Inert

source

pub const NfcInert: Self = _

Binary property NFC_Inert

source

pub const NfkcInert: Self = _

Binary property NFKC_Inert

source

pub const SegmentStarter: Self = _

Binary property Segment_Starter

source

pub const PatternSyntax: Self = _

Binary property Pattern_Syntax

source

pub const PatternWhiteSpace: Self = _

Binary property Pattern_White_Space

source

pub const Alnum: Self = _

Binary property alnum

source

pub const Blank: Self = _

Binary property blank

source

pub const Graph: Self = _

Binary property graph

source

pub const Print: Self = _

Binary property print

source

pub const XDigit: Self = _

Binary property xdigit

source

pub const Cased: Self = _

Binary property Cased

source

pub const CaseIgnorable: Self = _

Binary property Case_Ignorable

source

pub const ChangesWhenLowercased: Self = _

Binary property Changes_When_Lowercased

source

pub const ChangesWhenUppercased: Self = _

Binary property Changes_When_Uppercased

source

pub const ChangesWhenTitlecased: Self = _

Binary property Changes_When_Titlecased

source

pub const ChangesWhenCasefolded: Self = _

Binary property Changes_When_Casefolded

source

pub const ChangesWhenCasemapped: Self = _

Binary property Changes_When_Casemapped

source

pub const ChangesWhenNfkcCasefolded: Self = _

Binary property Changes_When_NFKC_Casefolded

source

pub const Emoji: Self = _

Binary property Emoji

source

pub const EmojiPresentation: Self = _

Binary property Emoji_Presentation

source

pub const EmojiModifier: Self = _

Binary property Emoji_Modifier

source

pub const EmojiModifierBase: Self = _

Binary property Emoji_Modifier_Base

source

pub const EmojiComponent: Self = _

Binary property Emoji_Component

source

pub const RegionalIndicator: Self = _

Binary property Regional_Indicator

source

pub const PrependedConcatenationMark: Self = _

Binary property Prepended_Concatenation_Mark

source

pub const ExtendedPictographic: Self = _

Binary property Extended_Pictographic

source

pub const BasicEmoji: Self = _

Binary property Basic_Emoji

source

pub const EmojiKeycapSequence: Self = _

Binary property Emoji_Keycap_Sequence

source

pub const RgiEmojiModifierSequence: Self = _

Binary property RGI_Emoji_Modifier_Sequence

source

pub const RgiEmojiFlagSequence: Self = _

Binary property RGI_Emoji_Flag_Sequence

source

pub const RgiEmojiTagSequence: Self = _

Binary property RGI_Emoji_Tag_Sequence

source

pub const RgiEmojiZWJSequence: Self = _

Binary property RGI_Emoji_ZWJ_Sequence

source

pub const RgiEmoji: Self = _

Binary property RGI_Emoji

source

const BINARY_MAX: Self = Self::RgiEmoji

source

pub const BidiClass: Self = _

Enumerated property Bidi_Class

source

pub const Block: Self = _

Enumerated property Block

source

pub const CombiningClass: Self = _

Enumerated property Canonical_Combining_Class

source

pub const DecompositionType: Self = _

Enumerated property Decomposition_Type

source

pub const EastAsianWidth: Self = _

Enumerated property East_Asian_Width

source

pub const GeneralCategory: Self = _

Enumerated property General_Category

source

pub const JoiningGroup: Self = _

Enumerated property Joining_Group

source

pub const JoiningType: Self = _

Enumerated property Joining_Type

source

pub const LineBreak: Self = _

Enumerated property Line_Break

source

pub const NumericType: Self = _

Enumerated property Numeric_Type

source

pub const Script: Self = _

Enumerated property Script

source

pub const HangulSyllableType: Self = _

Enumerated property Hangul_Syllable_Type

source

pub const NFDQuickCheck: Self = _

Enumerated property NFD_Quick_Check

source

pub const NFKDQuickCheck: Self = _

Enumerated property NFKD_Quick_Check

source

pub const NFCQuickCheck: Self = _

Enumerated property NFC_Quick_Check

source

pub const NFKCQuickCheck: Self = _

Enumerated property NFKC_Quick_Check

source

pub const LeadCanonicalCombiningClass: Self = _

Enumerated property Lead_Canonical_Combining_Class

source

pub const TrailCanonicalCombiningClass: Self = _

Enumerated property Trail_Canonical_Combining_Class

source

pub const GraphemeClusterBreak: Self = _

Enumerated property Grapheme_Cluster_Break

source

pub const SentenceBreak: Self = _

Enumerated property Sentence_Break

source

pub const WordBreak: Self = _

Enumerated property Word_Break

source

pub const BidiPairedBracketType: Self = _

Enumerated property Bidi_Paired_Bracket_Type

source

pub const IndicPositionalCategory: Self = _

Enumerated property Indic_Positional_Category

source

pub const IndicSyllabicCategory: Self = _

Enumerated property Indic_Syllabic_Category

source

pub const VerticalOrientation: Self = _

Enumerated property Vertical_Orientation

source

const ENUMERATED_MAX: Self = Self::VerticalOrientation

source

pub const GeneralCategoryMask: Self = _

Mask property General_Category_Mask

source

pub const NumericValue: Self = _

Double property Numeric_Value

source

pub const Age: Self = _

String property Age

source

pub const BidiMirroringGlyph: Self = _

String property Bidi_Mirroring_Glyph

source

pub const CaseFolding: Self = _

String property Case_Folding

source

pub const ISOComment: Self = _

String property ISO_Comment

source

pub const LowercaseMapping: Self = _

String property Lowercase_Mapping

source

pub const Name: Self = _

String property Name

source

pub const SimpleCaseFolding: Self = _

String property Simple_Case_Folding

source

pub const SimpleLowercaseMapping: Self = _

String property Simple_Lowercase_Mapping

source

pub const SimpleTitlecaseMapping: Self = _

String property Simple_Titlecase_Mapping

source

pub const SimpleUppercaseMapping: Self = _

String property Simple_Uppercase_Mapping

source

pub const TitlecaseMapping: Self = _

String property Titlecase_Mapping

source

pub const Unicode1_Name: Self = _

String property Unicode_1_Name

source

pub const UppercaseMapping: Self = _

String property Uppercase_Mapping

source

pub const BidiPairedBracket: Self = _

String property Bidi_Paired_Bracket

source

const STRING_MAX: Self = Self::BidiPairedBracket

source

pub const ScriptExtensions: Self = _

Misc property Script_Extensions

source§

impl UnicodeProperty

source

pub fn parse_ecma262_name(name: &str) -> Option<Self>

Given a property name (long, short, or alias), returns the corresponding UnicodeProperty value for it provided it belongs to the subset relevant for ECMA262 regexes

Returns none if the name does not match any of the names in this subset. Performs strict matching of names.

If using this to implement an ECMA262-compliant regex engine, please note these caveats:

  • This only returns binary and enumerated properties, as well as Self::ScriptExtensions. Lookup can be performed sufficiently with [Self::load_ecma262_binary_property_unstable()], maps::load_general_category(), maps::load_script() and script::load_script_with_extensions_unstable().
  • This does not handle the Any, Assigned, or ASCII pseudoproperties, since they are not defined as properties.
    • Any can be expressed as the range [\u{0}-\u{10FFFF}]
    • Assigned can be expressed as the inverse of the set gc=Cn (i.e., \P{gc=Cn}).
    • ASCII can be expressed as the range [\u{0}-\u{7F}]
  • ECMA262 regexes transparently allow General_Category_Mask values for GeneralCategory. This method does not return Self::GeneralCategoryMask, and instead relies on the caller to use mask-related lookup functions where necessary.
  • ECMA262 regexes allow treating General_Category (and gcm) values as binary properties, e.g. you can do things like \p{Lu} as shortform for \p{gc=Lu}. This method does not do so since these are property values, not properties, but you can use GeneralCategory::get_name_to_enum_mapper() or GeneralCategoryGroup::get_name_to_enum_mapper() to handle this.

Trait Implementations§

source§

impl Clone for UnicodeProperty

source§

fn clone(&self) -> UnicodeProperty

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for UnicodeProperty

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Hash for UnicodeProperty

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl Ord for UnicodeProperty

source§

fn cmp(&self, other: &UnicodeProperty) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized + PartialOrd,

Restrict a value to a certain interval. Read more
source§

impl PartialEq for UnicodeProperty

source§

fn eq(&self, other: &UnicodeProperty) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for UnicodeProperty

source§

fn partial_cmp(&self, other: &UnicodeProperty) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Copy for UnicodeProperty

source§

impl Eq for UnicodeProperty

source§

impl StructuralPartialEq for UnicodeProperty

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> ErasedDestructor for T
where T: 'static,

source§

impl<T> MaybeSendSync for T