pub struct Config { /* private fields */ }
Expand description
A collection of parameters that can influence the interpretation of time expressions.
Implementations§
source§impl Config
impl Config
sourcepub fn now(&self, n: NaiveDateTime) -> Config
pub fn now(&self, n: NaiveDateTime) -> Config
Returns a copy of the configuration parameters with the “now” moment set to the parameter supplied.
sourcepub fn monday_starts_week(&self, monday_starts_week: bool) -> Config
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.
sourcepub fn pay_period_length(&self, pay_period_length: u32) -> Config
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.
sourcepub fn pay_period_start(&self, pay_period_start: Option<NaiveDate>) -> Config
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.
sourcepub fn default_to_past(&self, default_to_past: bool) -> Config
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.