Day

Type Alias Day 

Source
pub type Day = ConstrainedValue<DayOfMonth>;
Expand description

Represents a constrained value for the day of the month (1-31)

Aliased Type§

pub enum Day {
    All,
    Range(DayOfMonth, DayOfMonth),
    Repetition {
        start: DayOfMonth,
        end: Option<DayOfMonth>,
        rep: u8,
    },
    Specific(Vec<DayOfMonth>),
}

Variants§

§

All

Every value

§

Range(DayOfMonth, DayOfMonth)

A range of values

§

Repetition

A repetition of values

This is a sequence of values: start, start + rep, start + 2*rep up to the optional end value. If no end value is given, it continues to the maximum Bounded value for the type.

Fields

§start: DayOfMonth

The value to start

§end: Option<DayOfMonth>

An optional end value

§rep: u8

The repetition value

§

Specific(Vec<DayOfMonth>)

Specific values

Trait Implementations§

Source§

impl ConstrainedValueParser<'_, DayOfMonth> for Day

Source§

fn invalid(s: &str) -> Error

The error to return for an invalid parse
Source§

fn allow_rand() -> bool

Whether to allow ‘R’ for random value
Source§

fn all() -> Self

The ‘all’ constrained value
Source§

fn rand() -> Self

The ‘rand’ constrained value
Source§

fn repetition_regex() -> Regex

The regex to match repetitions
Source§

fn range_regex() -> Regex

The regex to match ranges
Source§

fn rep(start: DayOfMonth, end: Option<DayOfMonth>, rep: u8) -> Self

The ‘repetition’ constrained value
Source§

fn range(first: DayOfMonth, second: DayOfMonth) -> Self

The ‘range’ constrained value
Source§

fn specific(values: Vec<DayOfMonth>) -> Self

The ‘specific’ constrained value
Source§

fn parse(s: &str) -> Result<Self>

Parse a constrained value from a string Read more
Source§

fn parse_range(s: &str) -> Result<Self>

Parse a range constrained value from a string Read more
Source§

fn parse_repetition(s: &str) -> Result<Self>

Parse a repetition constrained value from a string Read more
Source§

fn parse_specific(s: &str) -> Result<Self>

Parse a specific constrained value from a string Read more
Source§

impl Default for Day

Source§

fn default() -> Self

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

impl Display for Day

Source§

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

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

impl FromStr for Day

Source§

type Err = Error

The associated error which can be returned from parsing.
Source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
Source§

impl TryFrom<&str> for Day

Source§

type Error = Error

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

fn try_from(s: &str) -> Result<Self>

Performs the conversion.