Struct icu::experimental::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> BakeSize for Pattern<'data>
impl<'data> BakeSize for Pattern<'data>
source§fn borrows_size(&self) -> usize
fn borrows_size(&self) -> usize
source§impl<'de, 'data> Deserialize<'de> for Pattern<'data>where
'de: 'data,
impl<'de, 'data> Deserialize<'de> for Pattern<'data>where
'de: 'data,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Pattern<'data>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Pattern<'data>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
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> From<&'data PatternULE> for Pattern<'data>
impl<'data> From<&'data PatternULE> for Pattern<'data>
source§fn from(other: &'data PatternULE) -> Pattern<'data>
fn from(other: &'data PatternULE) -> Pattern<'data>
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> PartialOrd for Pattern<'data>
impl<'data> PartialOrd for Pattern<'data>
source§impl<'data> Serialize for Pattern<'data>
impl<'data> Serialize for Pattern<'data>
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl<'a> Yokeable<'a> for Pattern<'static>
impl<'a> Yokeable<'a> for Pattern<'static>
source§type Output = Pattern<'a>
type Output = Pattern<'a>
Self
with the 'static
replaced with 'a
, i.e. Self<'a>
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
.impl<'data> Eq for Pattern<'data>
impl<'data> StructuralPartialEq for Pattern<'data>
Auto Trait Implementations§
impl<'data> Freeze for Pattern<'data>
impl<'data> RefUnwindSafe for Pattern<'data>
impl<'data> Send for Pattern<'data>
impl<'data> Sync for Pattern<'data>
impl<'data> Unpin for Pattern<'data>
impl<'data> UnwindSafe for Pattern<'data>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more