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
The DateTime’s minutes value.
The DateTime’s hours value.
The DateTime’s day value.
The DateTime’s month value.
The DateTime’s weekday value.
Implementations
impl CronDatePart
[src]
pub fn fetch<Tz>(&self, datetime: &DateTime<Tz>) -> u32 where
Tz: TimeZone,
[src]
Tz: TimeZone,
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]
fn clone(&self) -> CronDatePart
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for CronDatePart
[src]
impl Debug for CronDatePart
[src]
impl Display for CronDatePart
[src]
impl PartialEq<CronDatePart> for CronDatePart
[src]
fn eq(&self, other: &CronDatePart) -> bool
[src]
#[must_use]pub fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]
pub fn ne(&self, other: &Rhs) -> boolimpl StructuralPartialEq for CronDatePart
[src]
Auto Trait Implementations
impl RefUnwindSafe for CronDatePart
impl Send for CronDatePart
impl Sync for CronDatePart
impl Unpin for CronDatePart
impl UnwindSafe for CronDatePart
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,