pub struct PluralPattern<'data> {
pub pivot_field: Week,
pub zero: Option<Pattern<'data>>,
pub one: Option<Pattern<'data>>,
pub two: Option<Pattern<'data>>,
pub few: Option<Pattern<'data>>,
pub many: Option<Pattern<'data>>,
pub other: Pattern<'data>,
}
Expand description
A collection of plural variants of a pattern.
Fields§
§pivot_field: Week
The field that ‘variants’ are predicated on.
zero: Option<Pattern<'data>>
§one: Option<Pattern<'data>>
§two: Option<Pattern<'data>>
§few: Option<Pattern<'data>>
§many: Option<Pattern<'data>>
§other: Pattern<'data>
Implementations§
source§impl<'data> PluralPattern<'data>
impl<'data> PluralPattern<'data>
sourcepub fn new(
pattern: Pattern<'data>,
) -> Result<PluralPattern<'data>, PatternError>
pub fn new( pattern: Pattern<'data>, ) -> Result<PluralPattern<'data>, PatternError>
Creates a PluralPattern
from a pattern containing a pivot field.
sourcepub fn pivot_field(&self) -> Week
pub fn pivot_field(&self) -> Week
Returns which week field determines the icu_plurals::PluralCategory used to select a pattern variant for a given date.
pub fn maybe_set_variant( &mut self, category: PluralCategory, pattern: Pattern<'data>, )
pub fn patterns_iter(&self) -> impl Iterator<Item = &Pattern<'data>>
pub fn for_each_mut<F>(&mut self, f: &F)
pub fn into_owned(self) -> PluralPattern<'static>
Trait Implementations§
source§impl<'data> Clone for PluralPattern<'data>
impl<'data> Clone for PluralPattern<'data>
source§fn clone(&self) -> PluralPattern<'data>
fn clone(&self) -> PluralPattern<'data>
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<'data> Debug for PluralPattern<'data>
impl<'data> Debug for PluralPattern<'data>
source§impl<'data> From<PluralPattern<'data>> for PatternPlurals<'data>
impl<'data> From<PluralPattern<'data>> for PatternPlurals<'data>
source§fn from(pattern: PluralPattern<'data>) -> PatternPlurals<'data>
fn from(pattern: PluralPattern<'data>) -> PatternPlurals<'data>
Converts to this type from the input type.
source§impl<'data> PartialEq for PluralPattern<'data>
impl<'data> PartialEq for PluralPattern<'data>
source§impl<'a> Yokeable<'a> for PluralPattern<'static>
impl<'a> Yokeable<'a> for PluralPattern<'static>
source§type Output = PluralPattern<'a>
type Output = PluralPattern<'a>
This type MUST be
Self
with the 'static
replaced with 'a
, i.e. Self<'a>
source§fn transform_owned(self) -> <PluralPattern<'static> as Yokeable<'a>>::Output
fn transform_owned(self) -> <PluralPattern<'static> as Yokeable<'a>>::Output
source§unsafe fn make(
this: <PluralPattern<'static> as Yokeable<'a>>::Output,
) -> PluralPattern<'static>
unsafe fn make( this: <PluralPattern<'static> as Yokeable<'a>>::Output, ) -> PluralPattern<'static>
This method can be used to cast away
Self<'a>
’s lifetime. Read moresource§fn transform_mut<F>(&'a mut self, f: F)
fn transform_mut<F>(&'a mut self, f: F)
This method must cast
self
between &'a mut Self<'static>
and &'a mut Self<'a>
,
and pass it to f
. Read moresource§impl<'zf, 'zf_inner> ZeroFrom<'zf, PluralPattern<'zf_inner>> for PluralPattern<'zf>
impl<'zf, 'zf_inner> ZeroFrom<'zf, PluralPattern<'zf_inner>> for PluralPattern<'zf>
source§fn zero_from(this: &'zf PluralPattern<'zf_inner>) -> PluralPattern<'zf>
fn zero_from(this: &'zf PluralPattern<'zf_inner>) -> PluralPattern<'zf>
Clone the other
C
into a struct that may retain references into C
.impl<'data> StructuralPartialEq for PluralPattern<'data>
Auto Trait Implementations§
impl<'data> Freeze for PluralPattern<'data>
impl<'data> RefUnwindSafe for PluralPattern<'data>
impl<'data> Send for PluralPattern<'data>
impl<'data> Sync for PluralPattern<'data>
impl<'data> Unpin for PluralPattern<'data>
impl<'data> UnwindSafe for PluralPattern<'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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
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>
Converts
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>
Converts
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