icu_properties::runtime

Struct 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,

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

impl PartialEq for UnicodeProperty

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

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

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

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

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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>,

Source§

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>,

Source§

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