pub struct Pattern<'data> {
pub items: ZeroVec<'data, PatternItem>,
pub metadata: PatternMetadata,
}
Expand description
A raw, low-level pattern for datetime formatting.
It consists of an owned-or-borrowed list of PatternItem
s corresponding
to either fields or literal characters.
๐ง 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, PatternItem>
The list of PatternItem
s.
metadata: PatternMetadata
Pre-computed metadata about the pattern.
This field should contain the smallest time unit from the items
vec.
If it doesnโt, unexpected results for day periods may be encountered.
Implementationsยง
Trait Implementationsยง
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>,
Deserialize this value from the given Serde deserializer. Read more
Sourceยงimpl Display for Pattern<'_>
This trait is implemented for compatibility with fmt!
.
To create a string, Writeable::write_to_string
is usually more efficient.
impl Display for Pattern<'_>
This trait is implemented for compatibility with fmt!
.
To create a string, Writeable::write_to_string
is usually more efficient.
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
Calls
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
Return the length, in bytes, of the corresponding
VarULE
typeSourceยงfn encode_var_ule_write(&self, dst: &mut [u8])
fn encode_var_ule_write(&self, dst: &mut [u8])
Write the corresponding
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
Calls
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
Return the length, in bytes, of the corresponding
VarULE
typeSourceยงfn encode_var_ule_write(&self, dst: &mut [u8])
fn encode_var_ule_write(&self, dst: &mut [u8])
Write the corresponding
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>
Converts to this type from the input type.
Sourceยงimpl From<DateTimePattern> for Pattern<'_>
impl From<DateTimePattern> for Pattern<'_>
Sourceยงfn from(value: DateTimePattern) -> Pattern<'_>
fn from(value: DateTimePattern) -> Pattern<'_>
Converts to this type from the input type.
Sourceยงimpl<'a> From<Pattern<'a>> for DateTimePattern
impl<'a> From<Pattern<'a>> for DateTimePattern
Sourceยงfn from(pattern: Pattern<'a>) -> DateTimePattern
fn from(pattern: Pattern<'a>) -> DateTimePattern
Converts to this type from the input type.
Sourceยงimpl FromIterator<PatternItem> for Pattern<'_>
impl FromIterator<PatternItem> for Pattern<'_>
Sourceยงfn from_iter<T>(iter: T) -> Pattern<'_>where
T: IntoIterator<Item = PatternItem>,
fn from_iter<T>(iter: T) -> Pattern<'_>where
T: IntoIterator<Item = PatternItem>,
Creates a value from an iterator. Read more
Sourceยงimpl Writeable for Pattern<'_>
This trait is implemented in order to provide the machinery to convert a Pattern
to a UTS 35
pattern string.
impl Writeable for Pattern<'_>
This trait is implemented in order to provide the machinery to convert a Pattern
to a UTS 35
pattern string.
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 Pattern<'static>
impl<'a> Yokeable<'a> for Pattern<'static>
Sourceยงtype Output = Pattern<'a>
type Output = Pattern<'a>
This type MUST be
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>
Clone the other
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
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