Skip to main content

DateTimeFunction

Struct DateTimeFunction 

Source
pub struct DateTimeFunction<B = DefaultBackend> { /* private fields */ }
Expand description

A date/time handler over the backend B: :datetime, :date, :time, or the unannotated one — the statics crate::DATETIME, crate::DATE, crate::TIME, crate::DATES over the default backend, or one built with the constructors over another.

Implementations§

Source§

impl<B> DateTimeFunction<B>

Source

pub const fn datetime(backend: B) -> Self

:datetime.

Source

pub const fn date(backend: B) -> Self

:date.

Source

pub const fn time(backend: B) -> Self

:time.

Source

pub const fn unannotated(backend: B) -> Self

The handler of unannotated date/time values, for Registry::with_dates: a value is formatted as :datetime with no options would format it — its own override options apply — and if that resolution reports an error, it is a fallback value with that error. Named in a registry, it is :datetime.

Source

pub const fn backend(&self) -> &B

The backend.

Trait Implementations§

Source§

impl<B: Clone> Clone for DateTimeFunction<B>

Source§

fn clone(&self) -> Self

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<B: Copy> Copy for DateTimeFunction<B>

Source§

impl<B: Debug> Debug for DateTimeFunction<B>

Source§

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

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

impl<B: Backend> Function for DateTimeFunction<B>

Source§

fn resolve<'a>( &self, cx: &FnContext<'_>, operand: Option<&Value<'a>>, options: &Options<'_, 'a>, errs: &mut dyn ErrorSink, ) -> Option<Value<'a>>

Function resolution (formatting.md): operand resolved — a Value::Fallback when it failed to resolve, so the handler decides (plans/03-runtime.md §2.6) — and options resolved with u:id/u:dir removed. None makes the expression a fallback value; the handler has reported why.
Source§

fn formattable( &self, cx: &FnContext<'_>, value: &Value<'_>, ) -> Result<(), FormatError>

Whether value can be formatted. Err(e): the placeholder is a fallback value and e is reported.
Source§

fn format(&self, cx: &FnContext<'_>, value: &Value<'_>, out: &mut dyn Sink)

Writes value’s formatted text.
Source§

fn format_parts( &self, cx: &FnContext<'_>, value: &Value<'_>, out: &mut dyn SubPartSink, )

Writes value’s formatted sub-parts (none by default).
Source§

fn part_kind(&self) -> &'static str

The type of this handler’s expression parts.
Source§

fn dir(&self, cx: &FnContext<'_>, value: &Value<'_>) -> Dir

The direction of value’s formatted text (Default Bidi Strategy); Auto = unknown.
Source§

fn selectable(&self, value: &Value<'_>) -> bool

Whether value supports selection (formatting.md, “Resolve Selectors”). A value that does not matches only *, with Bad Selector.
Source§

fn matches( &self, cx: &FnContext<'_>, value: &Value<'_>, key: &str, errs: &mut dyn ErrorSink, ) -> bool

Match(value, key); key is NFC. Report e.g. Bad Variant Key through errs.
Source§

fn better_than( &self, cx: &FnContext<'_>, value: &Value<'_>, key1: &str, key2: &str, ) -> bool

BetterThan(value, key1, key2), for two keys that both match.

Auto Trait Implementations§

§

impl<B> Freeze for DateTimeFunction<B>
where B: Freeze,

§

impl<B> RefUnwindSafe for DateTimeFunction<B>
where B: RefUnwindSafe,

§

impl<B> Send for DateTimeFunction<B>
where B: Send,

§

impl<B> Sync for DateTimeFunction<B>
where B: Sync,

§

impl<B> Unpin for DateTimeFunction<B>
where B: Unpin,

§

impl<B> UnsafeUnpin for DateTimeFunction<B>
where B: UnsafeUnpin,

§

impl<B> UnwindSafe for DateTimeFunction<B>
where B: UnwindSafe,

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> ErasedDestructor for T
where T: 'static,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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 = !

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.