Struct icu_properties::SentenceBreak
source · #[repr(transparent)]pub struct SentenceBreak(pub u8);
Expand description
Enumerated property Sentence_Break. See “Default Sentence Boundary Specification” in UAX #29 for the summary of each property value: https://www.unicode.org/reports/tr29/#Default_Word_Boundaries.
The numeric value is compatible with USentenceBreak
in ICU4C.
Tuple Fields§
§0: u8
Implementations§
source§impl SentenceBreak
impl SentenceBreak
pub const Other: SentenceBreak = _
pub const ATerm: SentenceBreak = _
pub const Close: SentenceBreak = _
pub const Format: SentenceBreak = _
pub const Lower: SentenceBreak = _
pub const Numeric: SentenceBreak = _
pub const OLetter: SentenceBreak = _
pub const Sep: SentenceBreak = _
pub const Sp: SentenceBreak = _
pub const STerm: SentenceBreak = _
pub const Upper: SentenceBreak = _
pub const CR: SentenceBreak = _
pub const Extend: SentenceBreak = _
pub const LF: SentenceBreak = _
pub const SContinue: SentenceBreak = _
source§impl SentenceBreak
impl SentenceBreak
sourcepub fn get_name_to_enum_mapper(
provider: &impl DataProvider<SentenceBreakNameToValueV1Marker> + ?Sized
) -> Result<PropertyValueNameToEnumMapper<SentenceBreak>, PropertiesError>
pub fn get_name_to_enum_mapper( provider: &impl DataProvider<SentenceBreakNameToValueV1Marker> + ?Sized ) -> Result<PropertyValueNameToEnumMapper<SentenceBreak>, PropertiesError>
Return a PropertyValueNameToEnumMapper
, capable of looking up values
from strings for the Sentence_Break
enumerated property
Example
use icu::properties::SentenceBreak;
let lookup = SentenceBreak::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("FO"), Some(SentenceBreak::Format));
assert_eq!(lookup.get_strict("NU"), Some(SentenceBreak::Numeric));
// long name for value
assert_eq!(lookup.get_strict("Format"), Some(SentenceBreak::Format));
assert_eq!(lookup.get_strict("Numeric"), Some(SentenceBreak::Numeric));
// name has incorrect casing
assert_eq!(lookup.get_strict("fOrmat"), None);
// loose matching of name
assert_eq!(lookup.get_loose("fOrmat"), Some(SentenceBreak::Format));
// fake property
assert_eq!(lookup.get_strict("Fixer_Upper"), None);
sourcepub fn get_enum_to_short_name_mapper(
provider: &impl DataProvider<SentenceBreakValueToShortNameV1Marker> + ?Sized
) -> Result<PropertyEnumToValueNameLinearMapper<SentenceBreak>, PropertiesError>
pub fn get_enum_to_short_name_mapper( provider: &impl DataProvider<SentenceBreakValueToShortNameV1Marker> + ?Sized ) -> Result<PropertyEnumToValueNameLinearMapper<SentenceBreak>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up short names
for values of the Sentence_Break
enumerated property
Example
use icu::properties::SentenceBreak;
let lookup = SentenceBreak::get_enum_to_short_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(SentenceBreak::Format), Some("FO"));
assert_eq!(lookup.get(SentenceBreak::Numeric), Some("NU"));
sourcepub fn get_enum_to_long_name_mapper(
provider: &impl DataProvider<SentenceBreakValueToLongNameV1Marker> + ?Sized
) -> Result<PropertyEnumToValueNameLinearMapper<SentenceBreak>, PropertiesError>
pub fn get_enum_to_long_name_mapper( provider: &impl DataProvider<SentenceBreakValueToLongNameV1Marker> + ?Sized ) -> Result<PropertyEnumToValueNameLinearMapper<SentenceBreak>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up long names
for values of the Sentence_Break
enumerated property
Example
use icu::properties::SentenceBreak;
let lookup = SentenceBreak::get_enum_to_long_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(SentenceBreak::Format), Some("Format"));
assert_eq!(lookup.get(SentenceBreak::Numeric), Some("Numeric"));
Trait Implementations§
source§impl AsULE for SentenceBreak
impl AsULE for SentenceBreak
source§impl Bake for SentenceBreak
impl Bake for SentenceBreak
source§fn bake(&self, env: &CrateEnv) -> TokenStream
fn bake(&self, env: &CrateEnv) -> TokenStream
source§impl Clone for SentenceBreak
impl Clone for SentenceBreak
source§fn clone(&self) -> SentenceBreak
fn clone(&self) -> SentenceBreak
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for SentenceBreak
impl Debug for SentenceBreak
source§impl<'de> Deserialize<'de> for SentenceBreak
impl<'de> Deserialize<'de> for SentenceBreak
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for SentenceBreak
impl Ord for SentenceBreak
source§fn cmp(&self, other: &SentenceBreak) -> Ordering
fn cmp(&self, other: &SentenceBreak) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<SentenceBreak> for SentenceBreak
impl PartialEq<SentenceBreak> for SentenceBreak
source§fn eq(&self, other: &SentenceBreak) -> bool
fn eq(&self, other: &SentenceBreak) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<SentenceBreak> for SentenceBreak
impl PartialOrd<SentenceBreak> for SentenceBreak
source§fn partial_cmp(&self, other: &SentenceBreak) -> Option<Ordering>
fn partial_cmp(&self, other: &SentenceBreak) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
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 moresource§impl Serialize for SentenceBreak
impl Serialize for SentenceBreak
source§impl TrieValue for SentenceBreak
impl TrieValue for SentenceBreak
§type TryFromU32Error = TryFromIntError
type TryFromU32Error = TryFromIntError
Last-resort fallback value to return if we cannot read data from the trie. Read more
source§fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
fn try_from_u32(i: u32) -> Result<Self, Self::TryFromU32Error>
A parsing function that is primarily motivated by deserialization contexts.
When the serialization type width is smaller than 32 bits, then it is expected
that the call site will widen the value to a
u32
first.source§impl<'a> ZeroMapKV<'a> for SentenceBreak
impl<'a> ZeroMapKV<'a> for SentenceBreak
§type Container = ZeroVec<'a, SentenceBreak>
type Container = ZeroVec<'a, SentenceBreak>
The container that can be used with this type:
ZeroVec
or VarZeroVec
.type Slice = ZeroSlice<SentenceBreak>
§type OwnedType = SentenceBreak
type OwnedType = SentenceBreak
The type produced by
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