Struct two_timer::Config

source ·
pub struct Config { /* private fields */ }
Expand description

A collection of parameters that can influence the interpretation of time expressions.

Implementations§

source§

impl Config

source

pub fn new() -> Config

Constructs an expression with the default parameters.

source

pub fn now(&self, n: NaiveDateTime) -> Config

Returns a copy of the configuration parameters with the “now” moment set to the parameter supplied.

source

pub fn monday_starts_week(&self, monday_starts_week: bool) -> Config

Returns a copy of the configuration parameters with whether Monday is regarded as the first day of the week set to the parameter supplied. By default Monday is regarded as the first day. If this parameter is set to false, Sunday will be regarded as the first weekday.

source

pub fn pay_period_length(&self, pay_period_length: u32) -> Config

Returns a copy of the configuration parameters with the pay period length in days set to the parameter supplied. The default pay period length is 7 days.

source

pub fn pay_period_start(&self, pay_period_start: Option<NaiveDate>) -> Config

Returns a copy of the configuration parameters with the reference start date for a pay period set to the parameter supplied. By default this date is undefined. Unless it is defined, expressions containing the phrase “pay period” or “pp” cannot be interpreted.

source

pub fn default_to_past(&self, default_to_past: bool) -> Config

Returns a copy of the configuration parameters with the default_to_past parameter set as specified. This allows the interpretation of relative time expressions like “Friday” and “12:00”. By default, these expressions are assumed to refer to the most recent such interval in the past. By setting default_to_past to false the rule changes so they are assumed to refer to the nearest such interval in the future.

Trait Implementations§

source§

impl Clone for Config

source§

fn clone(&self) -> Config

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Config

source§

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

Formats the value using the given formatter. Read more

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

§

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

§

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

§

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.