Struct PropertyParserBorrowed

struct PropertyParserBorrowed<'a, T> { ... }

A borrowed wrapper around property value name-to-enum data, returned by [PropertyParser::as_borrowed()]. More efficient to query.

Implementations

impl<T: TrieValue> PropertyParserBorrowed<'_, T>

fn get_strict_u16(self: Self, name: &str) -> Option<u16>

Get the property value as a u16, doing a strict search looking for names that match exactly

Example

use icu::properties::props::GeneralCategory;
use icu::properties::PropertyParser;

let lookup = PropertyParser::<GeneralCategory>::new();
assert_eq!(
    lookup.get_strict_u16("Lu"),
    Some(GeneralCategory::UppercaseLetter as u16)
);
assert_eq!(
    lookup.get_strict_u16("Uppercase_Letter"),
    Some(GeneralCategory::UppercaseLetter as u16)
);
// does not do loose matching
assert_eq!(lookup.get_strict_u16("UppercaseLetter"), None);
fn get_strict(self: Self, name: &str) -> Option<T>

Get the property value as a T, doing a strict search looking for names that match exactly

Example

use icu::properties::props::GeneralCategory;
use icu::properties::PropertyParser;

let lookup = PropertyParser::<GeneralCategory>::new();
assert_eq!(
    lookup.get_strict("Lu"),
    Some(GeneralCategory::UppercaseLetter)
);
assert_eq!(
    lookup.get_strict("Uppercase_Letter"),
    Some(GeneralCategory::UppercaseLetter)
);
// does not do loose matching
assert_eq!(lookup.get_strict("UppercaseLetter"), None);
fn get_loose_u16(self: Self, name: &str) -> Option<u16>

Get the property value as a u16, doing a loose search looking for names that match case-insensitively, ignoring ASCII hyphens, underscores, and whitespaces.

Example

use icu::properties::props::GeneralCategory;
use icu::properties::PropertyParser;

let lookup = PropertyParser::<GeneralCategory>::new();
assert_eq!(
    lookup.get_loose_u16("Lu"),
    Some(GeneralCategory::UppercaseLetter as u16)
);
assert_eq!(
    lookup.get_loose_u16("Uppercase_Letter"),
    Some(GeneralCategory::UppercaseLetter as u16)
);
// does do loose matching
assert_eq!(
    lookup.get_loose_u16("UppercaseLetter"),
    Some(GeneralCategory::UppercaseLetter as u16)
);
fn get_loose(self: Self, name: &str) -> Option<T>

Get the property value as a T, doing a loose search looking for names that match case-insensitively, ignoring ASCII hyphens, underscores, and whitespaces.

Example

use icu::properties::props::GeneralCategory;
use icu::properties::PropertyParser;

let lookup = PropertyParser::<GeneralCategory>::new();
assert_eq!(
    lookup.get_loose("Lu"),
    Some(GeneralCategory::UppercaseLetter)
);
assert_eq!(
    lookup.get_loose("Uppercase_Letter"),
    Some(GeneralCategory::UppercaseLetter)
);
// does do loose matching
assert_eq!(
    lookup.get_loose("UppercaseLetter"),
    Some(GeneralCategory::UppercaseLetter)
);

impl<T: TrieValue> PropertyParserBorrowed<'static, T>

fn new() -> Self
where
    T: ParseableEnumeratedProperty

Creates a new instance of PropertyParserBorrowed<T> using compiled data.

Enabled with the compiled_data Cargo feature.

📚 Help choosing a constructor

const fn static_to_owned(self: Self) -> PropertyParser<T>

Cheaply converts a [PropertyParserBorrowed<'static>] into a PropertyParser.

Note: Due to branching and indirection, using PropertyParser might inhibit some compile-time optimizations that are possible with PropertyParserBorrowed.

impl<'a, T> Freeze for PropertyParserBorrowed<'a, T>

impl<'a, T> RefUnwindSafe for PropertyParserBorrowed<'a, T>

impl<'a, T> Send for PropertyParserBorrowed<'a, T>

impl<'a, T> Sync for PropertyParserBorrowed<'a, T>

impl<'a, T> Unpin for PropertyParserBorrowed<'a, T>

impl<'a, T> UnsafeUnpin for PropertyParserBorrowed<'a, T>

impl<'a, T> UnwindSafe for PropertyParserBorrowed<'a, T>

impl<'a, T: $crate::fmt::Debug> Debug for PropertyParserBorrowed<'a, T>

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

impl<T> Any for PropertyParserBorrowed<'a, T>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for PropertyParserBorrowed<'a, T>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for PropertyParserBorrowed<'a, T>

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

impl<T> Clone for PropertyParserBorrowed<'_, T>

fn clone(self: &Self) -> Self

impl<T> CloneToUninit for PropertyParserBorrowed<'a, T>

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

impl<T> Copy for PropertyParserBorrowed<'_, T>

impl<T> ErasedDestructor for PropertyParserBorrowed<'a, T>

impl<T> From for PropertyParserBorrowed<'a, T>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for PropertyParserBorrowed<'a, T>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for PropertyParserBorrowed<'a, T>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for PropertyParserBorrowed<'a, T>

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

impl<T, U> TryInto for PropertyParserBorrowed<'a, T>

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

impl<T: ParseableEnumeratedProperty> Default for PropertyParserBorrowed<'static, T>

fn default() -> Self