pub struct CronExpression { /* private fields */ }Expand description
Cron expression wrapper with validation
Implementations§
Source§impl CronExpression
 
impl CronExpression
Sourcepub fn new(expression: &str) -> ScheduleResult<Self>
 
pub fn new(expression: &str) -> ScheduleResult<Self>
Create a new cron expression from a string
Supports standard 6-field cron format:
- 0 * * * * *(every minute)
- 0 0 0 * * *(daily at midnight)
- 0 0 */6 * * *(every 6 hours)
- 0 0 9-17 * * 1-5(weekdays 9-5)
Sourcepub fn expression(&self) -> &str
 
pub fn expression(&self) -> &str
Get the raw cron expression string
Sourcepub fn next_run_time(&self, after: DateTime<Utc>) -> Option<DateTime<Utc>>
 
pub fn next_run_time(&self, after: DateTime<Utc>) -> Option<DateTime<Utc>>
Get the next run time after the given datetime
Sourcepub fn next_run_times(
    &self,
    after: DateTime<Utc>,
    count: usize,
) -> Vec<DateTime<Utc>>
 
pub fn next_run_times( &self, after: DateTime<Utc>, count: usize, ) -> Vec<DateTime<Utc>>
Get the next N run times after the given datetime
Sourcepub fn should_run(&self, at: DateTime<Utc>) -> bool
 
pub fn should_run(&self, at: DateTime<Utc>) -> bool
Check if this schedule should run at the given time
Trait Implementations§
Source§impl Clone for CronExpression
 
impl Clone for CronExpression
Source§fn clone(&self) -> CronExpression
 
fn clone(&self) -> CronExpression
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
 
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from 
source. Read moreSource§impl Debug for CronExpression
 
impl Debug for CronExpression
Source§impl<'de> Deserialize<'de> for CronExpression
 
impl<'de> Deserialize<'de> for CronExpression
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
    D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for CronExpression
impl RefUnwindSafe for CronExpression
impl Send for CronExpression
impl Sync for CronExpression
impl Unpin for CronExpression
impl UnwindSafe for CronExpression
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
 
impl<T> BorrowMut<T> for Twhere
    T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more