#[non_exhaustive]pub enum BorrowedFormatItem<'a> {
Literal(&'a [u8]),
StringLiteral(&'a str),
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])
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(&'a str)
A string that is formatted as-is.
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<'a> Clone for BorrowedFormatItem<'a>
impl<'a> Clone for BorrowedFormatItem<'a>
Source§impl Debug for BorrowedFormatItem<'_>
Available on crate feature alloc only.
impl Debug for BorrowedFormatItem<'_>
alloc only.impl<'a> Eq for BorrowedFormatItem<'a>
impl Formattable for BorrowedFormatItem<'_>
formatting only.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<'_>
impl Parsable for BorrowedFormatItem<'_>
parsing only.Source§impl PartialEq for BorrowedFormatItem<'_>
impl PartialEq 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§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 &[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 ==.