pub struct CronNext<Z: TimeZone> {
pub schedule: Schedule,
/* private fields */
}Expand description
cron jobs
§Examples
let expression = "* * * * * ? *";
let mut cron = CronNext::new(expression, chrono::Local)?;
while let Some(time) = cron.next().await {
println!("time: {:?}, {:?}", time, chrono::Local::now());
}
println!("break");Fields§
§schedule: ScheduleImplementations§
Source§impl<Z> CronNext<Z>where
Z: TimeZone,
impl<Z> CronNext<Z>where
Z: TimeZone,
Sourcepub fn new(expression: &str, timezone: Z) -> Result<Self>
pub fn new(expression: &str, timezone: Z) -> Result<Self>
create a cron
§Examples
let expression = "* * * * * ? *";
let mut cron = CronNext::new(expression, chrono::Local)?;
while let Some(time) = cron.next().await {
println!("time: {:?}, {:?}", time, chrono::Local::now());
}
println!("break");Sourcepub async fn next(&mut self) -> Option<DateTime<Z>>
pub async fn next(&mut self) -> Option<DateTime<Z>>
the next job, ticker is 1 seconds
§Examples
let expression = "* * * * * ? *";
let mut cron = CronNext::new(expression, chrono::Local)?;
while let Some(time) = cron.next().await {
println!("time: {:?}, {:?}", time, chrono::Local::now());
}
println!("break");Auto Trait Implementations§
impl<Z> Freeze for CronNext<Z>
impl<Z> RefUnwindSafe for CronNext<Z>
impl<Z> Send for CronNext<Z>
impl<Z> Sync for CronNext<Z>
impl<Z> Unpin for CronNext<Z>
impl<Z> UnwindSafe for CronNext<Z>
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