#[non_exhaustive]pub enum BorrowedFormatItem<'a> {
Literal(&'a [u8]),
Component(Component),
Compound(&'a [Self]),
Optional(&'a Self),
First(&'a [Self]),
}
Expand description
A complete description of how to format and parse a type.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Literal(&'a [u8])
Bytes that are formatted as-is.
Note: These bytes should be UTF-8, but are not required to be. The value is passed
through String::from_utf8_lossy
when necessary.
Component(Component)
A minimal representation of a single non-literal item.
Compound(&'a [Self])
A series of literals or components that collectively form a partial or complete description.
Optional(&'a Self)
A FormatItem
that may or may not be present when parsing. If parsing fails, there
will be no effect on the resulting struct
.
This variant has no effect on formatting, as the value is guaranteed to be present.
First(&'a [Self])
A series of FormatItem
s where, when parsing, the first successful parse is used. When
formatting, the first element of the slice is used. An empty slice is a no-op when
formatting or parsing.
Trait Implementations§
source§impl AnyFormatItem for BorrowedFormatItem<'_>
impl AnyFormatItem for BorrowedFormatItem<'_>
source§fn parse_item<'a>(
&self,
parsed: &mut Parsed,
input: &'a [u8],
) -> Result<&'a [u8], ParseFromDescription>
fn parse_item<'a>( &self, parsed: &mut Parsed, input: &'a [u8], ) -> Result<&'a [u8], ParseFromDescription>
source§impl<'a> Clone for BorrowedFormatItem<'a>
impl<'a> Clone for BorrowedFormatItem<'a>
source§fn clone(&self) -> BorrowedFormatItem<'a>
fn clone(&self) -> BorrowedFormatItem<'a>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for BorrowedFormatItem<'_>
impl Debug for BorrowedFormatItem<'_>
source§impl<'a> From<&'a [BorrowedFormatItem<'_>]> for BorrowedFormatItem<'a>
impl<'a> From<&'a [BorrowedFormatItem<'_>]> for BorrowedFormatItem<'a>
source§fn from(items: &'a [BorrowedFormatItem<'_>]) -> Self
fn from(items: &'a [BorrowedFormatItem<'_>]) -> Self
source§impl From<&BorrowedFormatItem<'_>> for OwnedFormatItem
impl From<&BorrowedFormatItem<'_>> for OwnedFormatItem
source§fn from(item: &BorrowedFormatItem<'_>) -> Self
fn from(item: &BorrowedFormatItem<'_>) -> Self
source§impl From<BorrowedFormatItem<'_>> for OwnedFormatItem
impl From<BorrowedFormatItem<'_>> for OwnedFormatItem
source§fn from(item: BorrowedFormatItem<'_>) -> Self
fn from(item: BorrowedFormatItem<'_>) -> Self
source§impl From<Component> for BorrowedFormatItem<'_>
impl From<Component> for BorrowedFormatItem<'_>
source§impl PartialEq<&[BorrowedFormatItem<'_>]> for BorrowedFormatItem<'_>
impl PartialEq<&[BorrowedFormatItem<'_>]> for BorrowedFormatItem<'_>
source§impl PartialEq<BorrowedFormatItem<'_>> for &[BorrowedFormatItem<'_>]
impl PartialEq<BorrowedFormatItem<'_>> for &[BorrowedFormatItem<'_>]
source§fn eq(&self, rhs: &BorrowedFormatItem<'_>) -> bool
fn eq(&self, rhs: &BorrowedFormatItem<'_>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<BorrowedFormatItem<'_>> for Component
impl PartialEq<BorrowedFormatItem<'_>> for Component
source§fn eq(&self, rhs: &BorrowedFormatItem<'_>) -> bool
fn eq(&self, rhs: &BorrowedFormatItem<'_>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialEq<Component> for BorrowedFormatItem<'_>
impl PartialEq<Component> for BorrowedFormatItem<'_>
source§impl<'a> PartialEq for BorrowedFormatItem<'a>
impl<'a> PartialEq for BorrowedFormatItem<'a>
source§fn eq(&self, other: &BorrowedFormatItem<'a>) -> bool
fn eq(&self, other: &BorrowedFormatItem<'a>) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Sealed for BorrowedFormatItem<'_>
impl Sealed for BorrowedFormatItem<'_>
source§fn parse_date(&self, input: &[u8]) -> Result<Date, Parse>
fn parse_date(&self, input: &[u8]) -> Result<Date, Parse>
Date
from the format description.source§fn parse_time(&self, input: &[u8]) -> Result<Time, Parse>
fn parse_time(&self, input: &[u8]) -> Result<Time, Parse>
Time
from the format description.source§fn parse_offset(&self, input: &[u8]) -> Result<UtcOffset, Parse>
fn parse_offset(&self, input: &[u8]) -> Result<UtcOffset, Parse>
UtcOffset
from the format description.source§fn parse_primitive_date_time(
&self,
input: &[u8],
) -> Result<PrimitiveDateTime, Parse>
fn parse_primitive_date_time( &self, input: &[u8], ) -> Result<PrimitiveDateTime, Parse>
PrimitiveDateTime
from the format description.source§fn parse_offset_date_time(&self, input: &[u8]) -> Result<OffsetDateTime, Parse>
fn parse_offset_date_time(&self, input: &[u8]) -> Result<OffsetDateTime, Parse>
OffsetDateTime
from the format description.