Struct icu_properties::LineBreak
source · #[repr(transparent)]pub struct LineBreak(pub u8);
Expand description
Enumerated property Line_Break.
See “Line Breaking Properties” in UAX #14 for the summary of each property value: https://www.unicode.org/reports/tr14/#Properties
The numeric value is compatible with ULineBreak
in ICU4C.
Tuple Fields§
§0: u8
Implementations§
source§impl LineBreak
impl LineBreak
pub const Unknown: LineBreak = _
pub const Ambiguous: LineBreak = _
pub const Alphabetic: LineBreak = _
pub const BreakBoth: LineBreak = _
pub const BreakAfter: LineBreak = _
pub const BreakBefore: LineBreak = _
pub const MandatoryBreak: LineBreak = _
pub const ContingentBreak: LineBreak = _
pub const ClosePunctuation: LineBreak = _
pub const CombiningMark: LineBreak = _
pub const CarriageReturn: LineBreak = _
pub const Exclamation: LineBreak = _
pub const Glue: LineBreak = _
pub const Hyphen: LineBreak = _
pub const Ideographic: LineBreak = _
pub const Inseparable: LineBreak = _
pub const InfixNumeric: LineBreak = _
pub const LineFeed: LineBreak = _
pub const Nonstarter: LineBreak = _
pub const Numeric: LineBreak = _
pub const OpenPunctuation: LineBreak = _
pub const PostfixNumeric: LineBreak = _
pub const PrefixNumeric: LineBreak = _
pub const Quotation: LineBreak = _
pub const ComplexContext: LineBreak = _
pub const Surrogate: LineBreak = _
pub const Space: LineBreak = _
pub const BreakSymbols: LineBreak = _
pub const ZWSpace: LineBreak = _
pub const NextLine: LineBreak = _
pub const WordJoiner: LineBreak = _
pub const H2: LineBreak = _
pub const H3: LineBreak = _
pub const JL: LineBreak = _
pub const JT: LineBreak = _
pub const JV: LineBreak = _
pub const CloseParenthesis: LineBreak = _
pub const ConditionalJapaneseStarter: LineBreak = _
pub const HebrewLetter: LineBreak = _
pub const RegionalIndicator: LineBreak = _
pub const EBase: LineBreak = _
pub const EModifier: LineBreak = _
pub const ZWJ: LineBreak = _
source§impl LineBreak
impl LineBreak
sourcepub fn get_name_to_enum_mapper(
provider: &impl DataProvider<LineBreakNameToValueV1Marker> + ?Sized
) -> Result<PropertyValueNameToEnumMapper<LineBreak>, PropertiesError>
pub fn get_name_to_enum_mapper( provider: &impl DataProvider<LineBreakNameToValueV1Marker> + ?Sized ) -> Result<PropertyValueNameToEnumMapper<LineBreak>, PropertiesError>
Return a PropertyValueNameToEnumMapper
, capable of looking up values
from strings for the Line_Break
enumerated property
Example
use icu::properties::LineBreak;
let lookup = LineBreak::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("BK"), Some(LineBreak::MandatoryBreak));
assert_eq!(lookup.get_strict("AL"), Some(LineBreak::Alphabetic));
// long name for value
assert_eq!(lookup.get_strict("Mandatory_Break"), Some(LineBreak::MandatoryBreak));
assert_eq!(lookup.get_strict("Alphabetic"), Some(LineBreak::Alphabetic));
// name has incorrect casing and dash instead of underscore
assert_eq!(lookup.get_strict("mandatory-Break"), None);
// loose matching of name
assert_eq!(lookup.get_loose("mandatory-Break"), Some(LineBreak::MandatoryBreak));
// fake property
assert_eq!(lookup.get_strict("Stochastic_Break"), None);
sourcepub fn get_enum_to_short_name_mapper(
provider: &impl DataProvider<LineBreakValueToShortNameV1Marker> + ?Sized
) -> Result<PropertyEnumToValueNameLinearMapper<LineBreak>, PropertiesError>
pub fn get_enum_to_short_name_mapper( provider: &impl DataProvider<LineBreakValueToShortNameV1Marker> + ?Sized ) -> Result<PropertyEnumToValueNameLinearMapper<LineBreak>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up short names
for values of the Line_Break
enumerated property
Example
use icu::properties::LineBreak;
let lookup = LineBreak::get_enum_to_short_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(LineBreak::MandatoryBreak), Some("BK"));
assert_eq!(lookup.get(LineBreak::Alphabetic), Some("AL"));
sourcepub fn get_enum_to_long_name_mapper(
provider: &impl DataProvider<LineBreakValueToLongNameV1Marker> + ?Sized
) -> Result<PropertyEnumToValueNameLinearMapper<LineBreak>, PropertiesError>
pub fn get_enum_to_long_name_mapper( provider: &impl DataProvider<LineBreakValueToLongNameV1Marker> + ?Sized ) -> Result<PropertyEnumToValueNameLinearMapper<LineBreak>, PropertiesError>
Return a PropertyEnumToValueNameLinearMapper
, capable of looking up long names
for values of the Line_Break
enumerated property
Example
use icu::properties::LineBreak;
let lookup = LineBreak::get_enum_to_long_name_mapper(&icu_testdata::unstable())
.expect("The data should be valid");
let lookup = lookup.as_borrowed();
assert_eq!(lookup.get(LineBreak::MandatoryBreak), Some("Mandatory_Break"));
assert_eq!(lookup.get(LineBreak::Alphabetic), Some("Alphabetic"));
Trait Implementations§
source§impl<'de> Deserialize<'de> for LineBreak
impl<'de> Deserialize<'de> for LineBreak
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 LineBreak
impl Ord for LineBreak
source§impl PartialEq<LineBreak> for LineBreak
impl PartialEq<LineBreak> for LineBreak
source§impl PartialOrd<LineBreak> for LineBreak
impl PartialOrd<LineBreak> for LineBreak
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 TrieValue for LineBreak
impl TrieValue for LineBreak
§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.