#[non_exhaustive]pub enum BorrowedFormatItem<'a> {
Literal(&'a [u8]),
Component(Component),
Compound(&'a [Self]),
Optional(&'a Self),
First(&'a [Self]),
}formatting or parsing only.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 FormatItems 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<'_>
Available on crate feature parsing only.
impl AnyFormatItem for BorrowedFormatItem<'_>
parsing only.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>
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<'_>
Available on crate feature alloc only.
impl Debug for BorrowedFormatItem<'_>
alloc only.Source§impl<'a> Eq for BorrowedFormatItem<'a>
impl<'a> Eq for BorrowedFormatItem<'a>
#[doc(hidden)] fn assert_receiver_is_total_eq(&self)
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
Available on crate feature alloc only.
impl From<&BorrowedFormatItem<'_>> for OwnedFormatItem
alloc only.Source§fn from(item: &BorrowedFormatItem<'_>) -> Self
fn from(item: &BorrowedFormatItem<'_>) -> Self
Source§impl From<BorrowedFormatItem<'_>> for OwnedFormatItem
Available on crate feature alloc only.
impl From<BorrowedFormatItem<'_>> for OwnedFormatItem
alloc only.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§impl PartialEq<BorrowedFormatItem<'_>> for Component
impl PartialEq<BorrowedFormatItem<'_>> for Component
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§impl Sealed for BorrowedFormatItem<'_>
Available on crate feature formatting only.
impl Sealed for BorrowedFormatItem<'_>
formatting only.Source§impl Sealed for BorrowedFormatItem<'_>
Available on crate feature parsing only.
impl Sealed for BorrowedFormatItem<'_>
parsing only.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_utc_date_time(&self, input: &[u8]) -> Result<UtcDateTime, Parse>
fn parse_utc_date_time(&self, input: &[u8]) -> Result<UtcDateTime, Parse>
UtcDateTime 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.Source§impl TryFrom<BorrowedFormatItem<'_>> for Component
impl TryFrom<BorrowedFormatItem<'_>> for Component
Source§type Error = DifferentVariant
type Error = DifferentVariant
Source§impl<'a> TryFrom<BorrowedFormatItem<'a>> for &[BorrowedFormatItem<'a>]
impl<'a> TryFrom<BorrowedFormatItem<'a>> for &[BorrowedFormatItem<'a>]
Source§type Error = DifferentVariant
type Error = DifferentVariant
Source§impl<'a> TryFrom<Item<'a>> for BorrowedFormatItem<'a>
Available on crate feature alloc only.
impl<'a> TryFrom<Item<'a>> for BorrowedFormatItem<'a>
alloc only.impl Formattable for BorrowedFormatItem<'_>
formatting only.impl Parsable for BorrowedFormatItem<'_>
parsing only.impl<'a> StructuralPartialEq for BorrowedFormatItem<'a>
Auto Trait Implementations§
impl<'a> Freeze for BorrowedFormatItem<'a>
impl<'a> RefUnwindSafe for BorrowedFormatItem<'a>
impl<'a> Send for BorrowedFormatItem<'a>
impl<'a> Sync for BorrowedFormatItem<'a>
impl<'a> Unpin for BorrowedFormatItem<'a>
impl<'a> UnwindSafe for BorrowedFormatItem<'a>
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§impl<T> SizedTypeProperties for T
impl<T> SizedTypeProperties for T
Source§#[doc(hidden)] const SIZE: usize = _
#[doc(hidden)] const SIZE: usize = _
sized_type_properties)Source§#[doc(hidden)] const ALIGN: usize = _
#[doc(hidden)] const ALIGN: usize = _
sized_type_properties)Source§#[doc(hidden)] const IS_ZST: bool = _
#[doc(hidden)] const IS_ZST: bool = _
sized_type_properties)Source§#[doc(hidden)] const LAYOUT: Layout = _
#[doc(hidden)] const LAYOUT: Layout = _
sized_type_properties)Source§#[doc(hidden)] const MAX_SLICE_LEN: usize = _
#[doc(hidden)] const MAX_SLICE_LEN: usize = _
sized_type_properties)[Self]. Read more