pub struct GenericPattern<'data> {
    pub items: ZeroVec<'data, GenericPatternItem>,
}Expand description
A raw, low-level pattern with literals and placeholders.
This is a datetime-specific type designed to be binary-compatible with
Pattern. ICU4X developers looking for this sort of type should use
the icu_pattern crate instead.
๐ง This code is considered unstable; it may change at any time, in breaking or non-breaking ways,
including in SemVer minor releases. While the serde representation of data structs is guaranteed
to be stable, their Rust representation might not be. Use with caution.
Fieldsยง
ยงitems: ZeroVec<'data, GenericPatternItem>The list of GenericPatternItems.
Implementationsยง
Sourceยงimpl GenericPattern<'_>
 
impl GenericPattern<'_>
Sourceยงimpl<'data> GenericPattern<'data>
 
impl<'data> GenericPattern<'data>
Sourcepub fn combined(
    self,
    date: Pattern<'data>,
    time: Pattern<'data>,
) -> Result<Pattern<'static>, PatternError>
 
pub fn combined( self, date: Pattern<'data>, time: Pattern<'data>, ) -> Result<Pattern<'static>, PatternError>
The function allows for creation of new DTF pattern from a generic pattern and replacement patterns.
ยงExamples
use icu::datetime::provider::pattern::runtime::{GenericPattern, Pattern};
let date: Pattern = "y-M-d".parse().expect("Failed to parse pattern");
let time: Pattern = "HH:mm".parse().expect("Failed to parse pattern");
let glue: GenericPattern = "{1} 'at' {0}"
    .parse()
    .expect("Failed to parse generic pattern");
assert_eq!(
    glue.combined(date, time)
        .expect("Failed to combine patterns")
        .to_string(),
    "y-M-d 'at' HH:mm"
);Trait Implementationsยง
Sourceยงimpl<'data> Clone for GenericPattern<'data>
 
impl<'data> Clone for GenericPattern<'data>
Sourceยงfn clone(&self) -> GenericPattern<'data>
 
fn clone(&self) -> GenericPattern<'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 GenericPattern<'data>
 
impl<'data> Debug for GenericPattern<'data>
Sourceยงimpl Default for GenericPattern<'_>
 
impl Default for GenericPattern<'_>
Sourceยงfn default() -> GenericPattern<'_>
 
fn default() -> GenericPattern<'_>
Returns the โdefault valueโ for a type. Read more
Sourceยงimpl<'de, 'data> Deserialize<'de> for GenericPattern<'data>where
    'de: 'data,
 
impl<'de, 'data> Deserialize<'de> for GenericPattern<'data>where
    'de: 'data,
Sourceยงfn deserialize<D>(
    deserializer: D,
) -> Result<GenericPattern<'data>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<GenericPattern<'data>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Sourceยงimpl Display for GenericPattern<'_>
This trait is implemented for compatibility with fmt!.
To create a string, Writeable::write_to_string is usually more efficient.
 
impl Display for GenericPattern<'_>
This trait is implemented for compatibility with fmt!.
To create a string, Writeable::write_to_string is usually more efficient.
Sourceยงimpl From<&GenericPattern<'_>> for GenericPattern
 
impl From<&GenericPattern<'_>> for GenericPattern
Sourceยงfn from(input: &GenericPattern<'_>) -> GenericPattern
 
fn from(input: &GenericPattern<'_>) -> GenericPattern
Converts to this type from the input type.
Sourceยงimpl From<&GenericPattern> for GenericPattern<'_>
 
impl From<&GenericPattern> for GenericPattern<'_>
Sourceยงfn from(input: &GenericPattern) -> GenericPattern<'_>
 
fn from(input: &GenericPattern) -> GenericPattern<'_>
Converts to this type from the input type.
Sourceยงimpl FromStr for GenericPattern<'_>
 
impl FromStr for GenericPattern<'_>
Sourceยงtype Err = PatternError
 
type Err = PatternError
The associated error which can be returned from parsing.
Sourceยงfn from_str(
    s: &str,
) -> Result<GenericPattern<'_>, <GenericPattern<'_> as FromStr>::Err>
 
fn from_str( s: &str, ) -> Result<GenericPattern<'_>, <GenericPattern<'_> as FromStr>::Err>
Parses a string 
s to return a value of this type. Read moreSourceยงimpl<'data> PartialEq for GenericPattern<'data>
 
impl<'data> PartialEq for GenericPattern<'data>
Sourceยงimpl Writeable for GenericPattern<'_>
 
impl Writeable for GenericPattern<'_>
Sourceยงfn write_to<W>(&self, formatter: &mut W) -> Result<(), Error>
 
fn write_to<W>(&self, formatter: &mut W) -> Result<(), Error>
Writes a string to the given sink. Errors from the sink are bubbled up.
The default implementation delegates to 
write_to_parts, and discards any
Part annotations.Sourceยงfn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error>where
    S: PartsWrite + ?Sized,
 
fn write_to_parts<S>(&self, sink: &mut S) -> Result<(), Error>where
    S: PartsWrite + ?Sized,
Write bytes and 
Part annotations to the given sink. Errors from the
sink are bubbled up. The default implementation delegates to write_to,
and doesnโt produce any Part annotations.Sourceยงfn writeable_length_hint(&self) -> LengthHint
 
fn writeable_length_hint(&self) -> LengthHint
Returns a hint for the number of UTF-8 bytes that will be written to the sink. Read more
Sourceยงimpl<'a> Yokeable<'a> for GenericPattern<'static>
 
impl<'a> Yokeable<'a> for GenericPattern<'static>
Sourceยงtype Output = GenericPattern<'a>
 
type Output = GenericPattern<'a>
This type MUST be 
Self with the 'static replaced with 'a, i.e. Self<'a>Sourceยงfn transform_owned(self) -> <GenericPattern<'static> as Yokeable<'a>>::Output
 
fn transform_owned(self) -> <GenericPattern<'static> as Yokeable<'a>>::Output
Sourceยงunsafe fn make(
    this: <GenericPattern<'static> as Yokeable<'a>>::Output,
) -> GenericPattern<'static>
 
unsafe fn make( this: <GenericPattern<'static> as Yokeable<'a>>::Output, ) -> GenericPattern<'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, GenericPattern<'zf_inner>> for GenericPattern<'zf>
 
impl<'zf, 'zf_inner> ZeroFrom<'zf, GenericPattern<'zf_inner>> for GenericPattern<'zf>
Sourceยงfn zero_from(this: &'zf GenericPattern<'zf_inner>) -> GenericPattern<'zf>
 
fn zero_from(this: &'zf GenericPattern<'zf_inner>) -> GenericPattern<'zf>
Clone the other 
C into a struct that may retain references into C.impl<'data> Eq for GenericPattern<'data>
impl<'data> StructuralPartialEq for GenericPattern<'data>
Auto Trait Implementationsยง
impl<'data> Freeze for GenericPattern<'data>
impl<'data> RefUnwindSafe for GenericPattern<'data>
impl<'data> Send for GenericPattern<'data>
impl<'data> Sync for GenericPattern<'data>
impl<'data> Unpin for GenericPattern<'data>
impl<'data> UnwindSafe for GenericPattern<'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ยง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