Struct icu::compactdecimal::provider::Pattern
source · pub struct Pattern<'data> {
pub exponent: i8,
pub index: u8,
pub literal_text: Cow<'data, str>,
}
Expand description
A compact decimal pattern, representing some literal text with an optional placeholder, and the power of 10 expressed by the text.
Fields§
§exponent: i8
The compact decimal exponent, e.g., 6 for “million”.
The value 0 indicates that compact notation is not used; in that case,
literal text must be empty; this corresponds to the CLDR pattern “0”.
This is derived from the numbers of 0s in the pattern and the associated
type
attribute; it is a more convenient representation than the number
of 0s, because it is often common to multiple types; for instance, the
following correspond to the same Pattern
:
index: u8
The index in literal_text before which the placeholder is inserted; this is 0 for insertion at the beginning, which is most common. The value 255 indicates that the pattern does not have a placeholder, as in French “mille” for 1000.
literal_text: Cow<'data, str>
The underlying CLDR pattern with the placeholder removed, e.g., “ M“ for the pattern “000 M”
Trait Implementations§
source§impl<'data> EncodeAsVarULE<PatternULE> for &Pattern<'data>
impl<'data> EncodeAsVarULE<PatternULE> for &Pattern<'data>
source§fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R
fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R
cb
with a piecewise list of byte slices that when concatenated
produce the memory pattern of the corresponding instance of T
. Read moresource§fn encode_var_ule_len(&self) -> usize
fn encode_var_ule_len(&self) -> usize
VarULE
] typesource§fn encode_var_ule_write(&self, dst: &mut [u8])
fn encode_var_ule_write(&self, dst: &mut [u8])
VarULE
] type to the dst
buffer. dst
should
be the size of [Self::encode_var_ule_len()
]source§impl<'data> EncodeAsVarULE<PatternULE> for Pattern<'data>
impl<'data> EncodeAsVarULE<PatternULE> for Pattern<'data>
source§fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R
fn encode_var_ule_as_slices<R>(&self, cb: impl FnOnce(&[&[u8]]) -> R) -> R
cb
with a piecewise list of byte slices that when concatenated
produce the memory pattern of the corresponding instance of T
. Read moresource§fn encode_var_ule_len(&self) -> usize
fn encode_var_ule_len(&self) -> usize
VarULE
] typesource§fn encode_var_ule_write(&self, dst: &mut [u8])
fn encode_var_ule_write(&self, dst: &mut [u8])
VarULE
] type to the dst
buffer. dst
should
be the size of [Self::encode_var_ule_len()
]source§impl<'data> Ord for Pattern<'data>
impl<'data> Ord for Pattern<'data>
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl<'data> PartialEq<Pattern<'data>> for Pattern<'data>
impl<'data> PartialEq<Pattern<'data>> for Pattern<'data>
source§impl<'data> PartialOrd<Pattern<'data>> for Pattern<'data>
impl<'data> PartialOrd<Pattern<'data>> for Pattern<'data>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moresource§impl<'a> Yokeable<'a> for Pattern<'static>
impl<'a> Yokeable<'a> for Pattern<'static>
source§fn transform_owned(self) -> <Pattern<'static> as Yokeable<'a>>::Output
fn transform_owned(self) -> <Pattern<'static> as Yokeable<'a>>::Output
source§impl<'data> ZeroFrom<'data, PatternULE> for Pattern<'data>
impl<'data> ZeroFrom<'data, PatternULE> for Pattern<'data>
source§fn zero_from(other: &'data PatternULE) -> Pattern<'data>
fn zero_from(other: &'data PatternULE) -> Pattern<'data>
C
into a struct that may retain references into C
.