pub struct CronExpression { /* private fields */ }Expand description
Cron expression for scheduling tasks
Supports standard cron syntax with 5 fields:
minute hour day-of-month month day-of-week
§Examples
ⓘ
use ferro_rs::CronExpression;
// Every minute
let expr = CronExpression::every_minute();
// Daily at 3:00 AM
let expr = CronExpression::daily_at("03:00");
// Custom cron expression
let expr = CronExpression::parse("0 */2 * * *").unwrap(); // Every 2 hoursImplementations§
Source§impl CronExpression
impl CronExpression
Sourcepub fn parse(expression: &str) -> Result<Self, String>
pub fn parse(expression: &str) -> Result<Self, String>
Parse a cron expression string
Format: minute hour day-of-month month day-of-week
§Examples
* * * * *- Every minute0 * * * *- Every hour0 3 * * *- Daily at 3:00 AM0 0 * * 0- Weekly on Sunday*/5 * * * *- Every 5 minutes
Sourcepub fn expression(&self) -> &str
pub fn expression(&self) -> &str
Get the raw cron expression string
Sourcepub fn every_minute() -> Self
pub fn every_minute() -> Self
Every minute: * * * * *
Sourcepub fn every_n_minutes(n: u32) -> Self
pub fn every_n_minutes(n: u32) -> Self
Sourcepub fn daily_at(time: &str) -> Self
pub fn daily_at(time: &str) -> Self
Daily at specific time: M H * * *
Accepts "HH:MM" format. Falls back to midnight on invalid input.
Sourcepub fn monthly_on(day: u32) -> Self
pub fn monthly_on(day: u32) -> Self
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 moreAuto Trait Implementations§
impl Freeze for CronExpression
impl RefUnwindSafe for CronExpression
impl Send for CronExpression
impl Sync for CronExpression
impl Unpin for CronExpression
impl UnsafeUnpin 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more