#[non_exhaustive]pub enum OwnedFormatItem {
Literal(Box<[u8]>),
StringLiteral(Box<str>),
Component(Component),
Compound(Box<[Self]>),
Optional(Box<Self>),
First(Box<[Self]>),
}alloc and (crate features 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(Box<[u8]>)
use StringLiteral instead; raw bytes are not recommended
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.
StringLiteral(Box<str>)
A string that is formatted as-is.
Component(Component)
A minimal representation of a single non-literal item.
Compound(Box<[Self]>)
A series of literals or components that collectively form a partial or complete description.
Optional(Box<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(Box<[Self]>)
Trait Implementations§
Source§impl AnyFormatItem for OwnedFormatItem
Available on crate feature parsing only.
impl AnyFormatItem for OwnedFormatItem
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 Clone for OwnedFormatItem
impl Clone for OwnedFormatItem
Source§impl ComputeMetadata for OwnedFormatItem
Available on crate feature formatting only.
impl ComputeMetadata for OwnedFormatItem
formatting only.Source§fn compute_metadata(&self, _: PrivateMethod) -> Metadata
fn compute_metadata(&self, _: PrivateMethod) -> Metadata
Source§impl Debug for OwnedFormatItem
impl Debug for OwnedFormatItem
Source§impl Eq for OwnedFormatItem
impl Eq for OwnedFormatItem
Source§#[doc(hidden)]fn assert_fields_are_eq(&self)
#[doc(hidden)]fn assert_fields_are_eq(&self)
derive_eq_internals)1.0.0 (const: unstable) · Source§#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
#[doc(hidden)]fn assert_receiver_is_total_eq(&self)
implementation detail of #[derive(Eq)]
impl Formattable for OwnedFormatItem
formatting only.Source§impl From<&BorrowedFormatItem<'_>> for OwnedFormatItem
impl From<&BorrowedFormatItem<'_>> for OwnedFormatItem
Source§fn from(item: &BorrowedFormatItem<'_>) -> Self
fn from(item: &BorrowedFormatItem<'_>) -> Self
Source§impl<'a, T> From<&T> for OwnedFormatItem
impl<'a, T> From<&T> for OwnedFormatItem
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 OwnedFormatItem
impl From<Component> for OwnedFormatItem
Source§impl From<Vec<BorrowedFormatItem<'_>>> for OwnedFormatItem
impl From<Vec<BorrowedFormatItem<'_>>> for OwnedFormatItem
Source§fn from(items: Vec<BorrowedFormatItem<'_>>) -> Self
fn from(items: Vec<BorrowedFormatItem<'_>>) -> Self
Source§impl From<Vec<OwnedFormatItem>> for OwnedFormatItem
impl From<Vec<OwnedFormatItem>> for OwnedFormatItem
impl Parsable for OwnedFormatItem
parsing only.Source§impl PartialEq for OwnedFormatItem
impl PartialEq for OwnedFormatItem
Source§impl PartialEq<&[OwnedFormatItem]> for OwnedFormatItem
impl PartialEq<&[OwnedFormatItem]> for OwnedFormatItem
Source§impl PartialEq<Component> for OwnedFormatItem
impl PartialEq<Component> for OwnedFormatItem
Source§impl PartialEq<OwnedFormatItem> for Component
impl PartialEq<OwnedFormatItem> for Component
Source§impl PartialEq<OwnedFormatItem> for &[OwnedFormatItem]
impl PartialEq<OwnedFormatItem> for &[OwnedFormatItem]
Source§impl Sealed for OwnedFormatItem
Available on crate feature formatting only.
impl Sealed for OwnedFormatItem
formatting only.Source§fn format_into<V>(
&self,
output: &mut (impl Write + ?Sized),
value: &V,
state: &mut V::State,
_: PrivateMethod,
) -> Result<usize, Format>where
V: ComponentProvider,
fn format_into<V>(
&self,
output: &mut (impl Write + ?Sized),
value: &V,
state: &mut V::State,
_: PrivateMethod,
) -> Result<usize, Format>where
V: ComponentProvider,
Source§fn format<V>(
&self,
value: &V,
state: &mut V::State,
_: PrivateMethod,
) -> Result<String, Format>where
V: ComponentProvider,
fn format<V>(
&self,
value: &V,
state: &mut V::State,
_: PrivateMethod,
) -> Result<String, Format>where
V: ComponentProvider,
String.Source§impl Sealed for OwnedFormatItem
Available on crate feature parsing only.
impl Sealed for OwnedFormatItem
parsing only.Source§fn parse_into<'a>(
&self,
input: &'a [u8],
parsed: &mut Parsed,
_: PrivateMethod,
) -> Result<&'a [u8], Parse>
fn parse_into<'a>( &self, input: &'a [u8], parsed: &mut Parsed, _: PrivateMethod, ) -> Result<&'a [u8], Parse>
Source§#[doc(hidden)]fn parse(&self, input: &[u8]) -> Result<Parsed, Parse>
#[doc(hidden)]fn parse(&self, input: &[u8]) -> Result<Parsed, Parse>
use the parse method on the target type; this method has never been part of the public API and will be removed in a future release
Source§fn parse_internal(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<Parsed, Parse>
fn parse_internal( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<Parsed, Parse>
Source§fn parse_date(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<Date, Parse>
fn parse_date( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<Date, Parse>
Date from the format description.Source§fn parse_time(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<Time, Parse>
fn parse_time( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<Time, Parse>
Time from the format description.Source§fn parse_offset(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<UtcOffset, Parse>
fn parse_offset( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<UtcOffset, Parse>
UtcOffset from the format description.Source§fn parse_plain_date_time(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<PlainDateTime, Parse>
fn parse_plain_date_time( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<PlainDateTime, Parse>
PlainDateTime from the format description.Source§fn parse_utc_date_time(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<UtcDateTime, Parse>
fn parse_utc_date_time( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<UtcDateTime, Parse>
UtcDateTime from the format description.Source§fn parse_offset_date_time(
&self,
input: &[u8],
defaults: Option<Parsed>,
_: PrivateMethod,
) -> Result<OffsetDateTime, Parse>
fn parse_offset_date_time( &self, input: &[u8], defaults: Option<Parsed>, _: PrivateMethod, ) -> Result<OffsetDateTime, Parse>
OffsetDateTime from the format description.Source§impl TryFrom<OwnedFormatItem> for Component
impl TryFrom<OwnedFormatItem> for Component
Source§type Error = DifferentVariant
type Error = DifferentVariant
Source§impl TryFrom<OwnedFormatItem> for Vec<OwnedFormatItem>
impl TryFrom<OwnedFormatItem> for Vec<OwnedFormatItem>
Source§type Error = DifferentVariant
type Error = DifferentVariant
Auto Trait Implementations§
impl Freeze for OwnedFormatItem
impl RefUnwindSafe for OwnedFormatItem
impl Send for OwnedFormatItem
impl Sync for OwnedFormatItem
impl Unpin for OwnedFormatItem
impl UnsafeUnpin for OwnedFormatItem
impl UnwindSafe for OwnedFormatItem
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> SizeHint for Twhere
T: ?Sized,
impl<T> SizeHint for Twhere
T: ?Sized,
Source§default fn lower_bound(&self) -> usize
default fn lower_bound(&self) -> usize
core_io_internals)[u8; 12] could return any value between 0 and
12 inclusively as a correct implementation. Read moreSource§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 ALIGNMENT: Alignment = _
#[doc(hidden)]const ALIGNMENT: Alignment = _
ptr_alignment_type)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