Skip to main content

Fmt

Struct Fmt 

Source
pub struct Fmt {
    pub form: Form,
    pub sep: char,
    pub sub_sep: char,
    pub precision: Precision,
    pub pad: bool,
    pub locale: LocaleId,
}
Expand description

Formatting context (§13).

Fields§

§form: Form

Which form to render.

§sep: char

Group separator. Must not be a decimal or base-5 digit (§6.3).

§sub_sep: char

Sub-beat introducer.

§precision: Precision

The tier to render down to. This is the stated precision.

§pad: bool

Pad the high end to a fixed tier width, which is the only condition under which text sorts chronologically (Rule S).

§locale: LocaleId

Locale for the named form.

Implementations§

Source§

impl Fmt

Source

pub fn human() -> Fmt

Human form at tick precision.

Source

pub fn human_at(tier: Tier) -> Fmt

Human form truncated to a tier. The result denotes a window (Rule T).

Source

pub fn digit5() -> Fmt

Canonical digit form: fixed width from T32, tick precision, sortable.

Uses . rather than the · default, matching §6.2’s printed example. Both separators parse either form (§6.3), so this is presentation only.

Source

pub fn named() -> Fmt

Named form.

Source

pub fn validate(&self) -> Result<()>

Validate the separator choices (§6.3).

A separator that is also a digit would make the notation ambiguous, so this is checked rather than assumed.

Trait Implementations§

Source§

impl Clone for Fmt

Source§

fn clone(&self) -> Fmt

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 Fmt

Source§

impl Debug for Fmt

Source§

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

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

impl Default for Fmt

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Eq for Fmt

Source§

impl PartialEq for Fmt

Source§

fn eq(&self, other: &Fmt) -> 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 Fmt

Auto Trait Implementations§

§

impl Freeze for Fmt

§

impl RefUnwindSafe for Fmt

§

impl Send for Fmt

§

impl Sync for Fmt

§

impl Unpin for Fmt

§

impl UnsafeUnpin for Fmt

§

impl UnwindSafe for Fmt

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<U> As for U

Source§

fn as_<T>(self) -> T
where T: CastFrom<U>, U: Sized,

Casts self to type T. The semantics of numeric casting with the as operator are followed, so <T as As>::as_::<U> can be used in the same way as T as U for numeric conversions. 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

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

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.