Struct DateTimeBuilder

Source
pub struct DateTimeBuilder<'a> { /* private fields */ }
Expand description

Builder for datetime operations.

This builder provides a fluent interface for creating datetime operations such as current time, date formatting, parsing, etc.

Implementations§

Source§

impl<'a> DateTimeBuilder<'a>

Source

pub fn new(arena: &'a DataArena) -> Self

Creates a new datetime builder.

Source

pub fn now_op(&self) -> Logic<'a>

Creates a now operation that returns the current date and time.

Source

pub fn parse_date_op<S, F>(&self, date_str: S, format: F) -> Logic<'a>
where S: Into<Logic<'a>>, F: Into<Logic<'a>>,

Creates a parse_date operation that parses a date string according to a format.

Source

pub fn parse_date(&self, date_str: &str, format: &str) -> Logic<'a>

Creates a parse_date operation with string literals.

Source

pub fn format_date_op<D, F>(&self, date: D, format: F) -> Logic<'a>
where D: Into<Logic<'a>>, F: Into<Logic<'a>>,

Creates a format_date operation that formats a date according to a format string.

Source

pub fn date_diff_op<D1, D2, U>( &self, date1: D1, date2: D2, unit: U, ) -> Logic<'a>
where D1: Into<Logic<'a>>, D2: Into<Logic<'a>>, U: Into<Logic<'a>>,

Creates a date_diff operation that calculates the difference between two dates.

Source

pub fn date_diff<D1, D2>(&self, date1: D1, date2: D2, unit: &str) -> Logic<'a>
where D1: Into<Logic<'a>>, D2: Into<Logic<'a>>,

Creates a date_diff operation with string unit.

Auto Trait Implementations§

§

impl<'a> Freeze for DateTimeBuilder<'a>

§

impl<'a> !RefUnwindSafe for DateTimeBuilder<'a>

§

impl<'a> !Send for DateTimeBuilder<'a>

§

impl<'a> !Sync for DateTimeBuilder<'a>

§

impl<'a> Unpin for DateTimeBuilder<'a>

§

impl<'a> !UnwindSafe for DateTimeBuilder<'a>

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> 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, 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.