Enum curds_cron::CronDatePart[][src]

pub enum CronDatePart {
    Minutes,
    Hours,
    DayOfMonth,
    Month,
    DayOfWeek,
}

An enum to represent the various parts of a DateTime against which a CronExpression can match.

Variants

Minutes

The DateTime’s minutes value.

Hours

The DateTime’s hours value.

DayOfMonth

The DateTime’s day value.

Month

The DateTime’s month value.

DayOfWeek

The DateTime’s weekday value.

Implementations

impl CronDatePart[src]

pub fn fetch<Tz>(&self, datetime: &DateTime<Tz>) -> u32 where
    Tz: TimeZone
[src]

Fetches the appropriate part of the DateTime.

use chrono::{DateTime, Timelike, Utc};
use curds_cron::CronDatePart;
let part = CronDatePart::Minutes;
let now = Utc::now();
assert_eq!(now.minute(), part.fetch(&now));

pub fn min(&self) -> u32[src]

Return the minimum allowable value for the part.

use curds_cron::CronDatePart;
let part = CronDatePart::Hours;
assert_eq!(0, part.min());

pub fn max(&self) -> u32[src]

Return the maximum allowable value for the part.

use curds_cron::CronDatePart;
let part = CronDatePart::Month;
assert_eq!(12, part.max());

pub fn translate<'a>(&self, value: &'a str) -> &'a str[src]

Translate a value into its numeric representation, if possible. Will return the supplied string if it is not a recognized alias.

use curds_cron::CronDatePart;
let part = CronDatePart::DayOfWeek;
assert_eq!("5", part.translate("Fri"));
assert_eq!("foo", part.translate("foo"));

Trait Implementations

impl Clone for CronDatePart[src]

impl Copy for CronDatePart[src]

impl Debug for CronDatePart[src]

impl Display for CronDatePart[src]

impl PartialEq<CronDatePart> for CronDatePart[src]

impl StructuralPartialEq for CronDatePart[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.