Skip to main content

FormatDirective

Enum FormatDirective 

Source
pub enum FormatDirective {
Show 18 variants Year4, Year2, MonthNumber, DayOfMonth, DayOfMonthSpaced, Hour24, Hour12, Minute, Second, Fraction, Meridiem, DayOfYear, MonthAbbrev, MonthName, WeekdayAbbrev, WeekdayName, Offset, ZoneName,
}
Expand description

One thing a format says, in the strftime family’s own vocabulary.

The list is what the family agrees on. A directive outside it is refused by name when the design is read, rather than being passed to an engine that would either ignore it or read it as something else.

Variants§

§

Year4

%Y — the year in four digits.

§

Year2

%y — the year in two digits.

§

MonthNumber

%m — the month as a number.

§

DayOfMonth

%d — the day of the month, zero-padded or not.

§

DayOfMonthSpaced

%e — the day of the month, space-padded or not.

§

Hour24

%H — the hour on a twenty-four hour clock.

§

Hour12

%I — the hour on a twelve hour clock, read with Self::Meridiem.

§

Minute

%M — the minute.

§

Second

%S — the second.

§

Fraction

%f — the fraction of a second.

§

Meridiem

%p — AM or PM.

§

DayOfYear

%j — the day of the year.

§

MonthAbbrev

%b — the month’s name, abbreviated.

§

MonthName

%B — the month’s name in full.

§

WeekdayAbbrev

%a — the weekday’s name, abbreviated.

§

WeekdayName

%A — the weekday’s name in full.

§

Offset

%z — the offset from UTC, as +0000 or +00:00.

§

ZoneName

%Z — the time zone’s name.

Implementations§

Source§

impl FormatDirective

Source

pub fn spelled(self) -> &'static str

The directive as a format writes it, % and all.

Source

pub fn means(self) -> &'static str

What this directive is, in the words a refusal uses.

Source

pub fn names_a_zone(self) -> bool

True where this directive says something about a moment within a day — an offset or a zone name, which a column holding a day alone has nowhere to put.

Trait Implementations§

Source§

impl Clone for FormatDirective

Source§

fn clone(&self) -> FormatDirective

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FormatDirective

Source§

impl Debug for FormatDirective

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Display for FormatDirective

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for FormatDirective

Source§

impl Hash for FormatDirective

Source§

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

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for FormatDirective

Source§

fn eq(&self, other: &FormatDirective) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FormatDirective

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.