Enum cursive::reexports::time::format_description::FormatItem [−]
#[non_exhaustive]
pub enum FormatItem<'a> {
Literal(&'a [u8]),
Component(Component),
Compound(&'a [FormatItem<'a>]),
Optional(&'a FormatItem<'a>),
First(&'a [FormatItem<'a>]),
}
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: If you call the format
method that returns a String
, these bytes will be
passed through String::from_utf8_lossy
.
Component(Component)
Tuple Fields
0: Component
A minimal representation of a single non-literal item.
Compound(&'a [FormatItem<'a>])
Tuple Fields
0: &'a [FormatItem<'a>]
A series of literals or components that collectively form a partial or complete description.
Optional(&'a FormatItem<'a>)
Tuple Fields
0: &'a FormatItem<'a>
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 [FormatItem<'a>])
Tuple Fields
0: &'a [FormatItem<'a>]
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
impl<'a> Clone for FormatItem<'a>
impl<'a> Clone for FormatItem<'a>
pub fn clone(&self) -> FormatItem<'a>
pub fn clone(&self) -> FormatItem<'a>
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl<'_> Debug for FormatItem<'_>
impl<'_> Debug for FormatItem<'_>
impl<'a, '_> From<&'a [FormatItem<'_>]> for FormatItem<'a>
impl<'a, '_> From<&'a [FormatItem<'_>]> for FormatItem<'a>
pub fn from(items: &'a [FormatItem<'_>]) -> FormatItem<'a>
pub fn from(items: &'a [FormatItem<'_>]) -> FormatItem<'a>
Performs the conversion.
impl<'_> From<Component> for FormatItem<'_>
impl<'_> From<Component> for FormatItem<'_>
pub fn from(component: Component) -> FormatItem<'_>
pub fn from(component: Component) -> FormatItem<'_>
Performs the conversion.
impl<'_, '_, '_> PartialEq<&'_ [FormatItem<'_>]> for FormatItem<'_>
impl<'_, '_, '_> PartialEq<&'_ [FormatItem<'_>]> for FormatItem<'_>
impl<'_> PartialEq<Component> for FormatItem<'_>
impl<'_> PartialEq<Component> for FormatItem<'_>
impl<'_, '_, '_> PartialEq<FormatItem<'_>> for &'_ [FormatItem<'_>]
impl<'_, '_, '_> PartialEq<FormatItem<'_>> for &'_ [FormatItem<'_>]
impl<'_> PartialEq<FormatItem<'_>> for Component
impl<'_> PartialEq<FormatItem<'_>> for Component
impl<'a> PartialEq<FormatItem<'a>> for FormatItem<'a>
impl<'a> PartialEq<FormatItem<'a>> for FormatItem<'a>
pub fn eq(&self, other: &FormatItem<'a>) -> bool
pub fn eq(&self, other: &FormatItem<'a>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
pub fn ne(&self, other: &FormatItem<'a>) -> bool
pub fn ne(&self, other: &FormatItem<'a>) -> bool
This method tests for !=
.
impl<'_> TryFrom<FormatItem<'_>> for Component
impl<'_> TryFrom<FormatItem<'_>> for Component
type Error = DifferentVariant
type Error = DifferentVariant
The type returned in the event of a conversion error.
pub fn try_from(
value: FormatItem<'_>
) -> Result<Component, <Component as TryFrom<FormatItem<'_>>>::Error>
pub fn try_from(
value: FormatItem<'_>
) -> Result<Component, <Component as TryFrom<FormatItem<'_>>>::Error>
Performs the conversion.
impl<'a, '_> TryFrom<FormatItem<'a>> for &'_ [FormatItem<'a>]
impl<'a, '_> TryFrom<FormatItem<'a>> for &'_ [FormatItem<'a>]
type Error = DifferentVariant
type Error = DifferentVariant
The type returned in the event of a conversion error.
pub fn try_from(
value: FormatItem<'a>
) -> Result<&'_ [FormatItem<'a>], <&'_ [FormatItem<'a>] as TryFrom<FormatItem<'a>>>::Error>
pub fn try_from(
value: FormatItem<'a>
) -> Result<&'_ [FormatItem<'a>], <&'_ [FormatItem<'a>] as TryFrom<FormatItem<'a>>>::Error>
Performs the conversion.
impl<'a> Eq for FormatItem<'a>
impl<'_> Formattable for FormatItem<'_>
impl<'a> StructuralEq for FormatItem<'a>
impl<'a> StructuralPartialEq for FormatItem<'a>
Auto Trait Implementations
impl<'a> RefUnwindSafe for FormatItem<'a>
impl<'a> Send for FormatItem<'a>
impl<'a> Sync for FormatItem<'a>
impl<'a> Unpin for FormatItem<'a>
impl<'a> UnwindSafe for FormatItem<'a>
Blanket Implementations
Mutably borrows from an owned value. Read more
Calls the given closure and return the result. Read more
Calls the given closure on self
.