Enum Item

enum Item<'a>

A single formatting item. This is used for both formatting and parsing.

Variants

Literal(&'a str)

A literally printed and parsed text.

OwnedLiteral(Box<str>)

Same as Literal but with the string owned by the item.

Space(&'a str)

Whitespace. Prints literally but reads zero or more whitespace.

OwnedSpace(Box<str>)

Same as Space but with the string owned by the item.

Numeric(Numeric, Pad)

Numeric item. Can be optionally padded to the maximal length (if any) when formatting; the parser simply ignores any padded whitespace and zeroes.

Fixed(Fixed)

Fixed-format item.

Error

Issues a formatting error. Used to signal an invalid format string.

Implementations

impl Item<'_>

fn to_owned(self: Self) -> Item<'static>

Convert items that contain a reference to the format string into an owned variant.

impl<'a> Clone for Item<'a>

fn clone(self: &Self) -> Item<'a>

impl<'a> Debug for Item<'a>

fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result

impl<'a> Eq for Item<'a>

impl<'a> Freeze for Item<'a>

impl<'a> Hash for Item<'a>

fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)

impl<'a> PartialEq for Item<'a>

fn eq(self: &Self, other: &Item<'a>) -> bool

impl<'a> RefUnwindSafe for Item<'a>

impl<'a> Send for Item<'a>

impl<'a> StructuralPartialEq for Item<'a>

impl<'a> Sync for Item<'a>

impl<'a> Unpin for Item<'a>

impl<'a> UnwindSafe for Item<'a>

impl<T> Any for Item<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Item<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Item<'a>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for Item<'a>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for Item<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Item<'a>

fn to_owned(self: &Self) -> T
fn clone_into(self: &Self, target: &mut T)

impl<T, U> Into for Item<'a>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for Item<'a>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for Item<'a>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>