pub struct JobItem { /* private fields */ }Expand description
An internal wrapper around a JobContract that caches the parsed schedule
and exposes helper methods used by the scheduler.
Constructed once per registered job via JobItem::new, ensuring the
schedule is valid at registration time rather than at execution time.
Implementations§
Source§impl JobItem
impl JobItem
Sourcepub fn new(
job: Arc<dyn JobContract>,
listeners: Vec<Arc<dyn JobEventListener>>,
metrics_exporter: Option<Arc<dyn MetricsExporter>>,
job_store: Option<Arc<dyn JobStore>>,
) -> CronResult<Self>
pub fn new( job: Arc<dyn JobContract>, listeners: Vec<Arc<dyn JobEventListener>>, metrics_exporter: Option<Arc<dyn MetricsExporter>>, job_store: Option<Arc<dyn JobStore>>, ) -> CronResult<Self>
Wrap a JobContract implementor.
The schedule is validated via JobContract::schedule at this point.
Returns an error if the job’s schedule is invalid.
Sourcepub fn next_run_time(&self) -> Option<DateTime<Utc>>
pub fn next_run_time(&self) -> Option<DateTime<Utc>>
Computes the next scheduled execution time from now.
Sourcepub fn next_run_after(&self, after: DateTime<Utc>) -> Option<DateTime<Utc>>
pub fn next_run_after(&self, after: DateTime<Utc>) -> Option<DateTime<Utc>>
Computes the next scheduled execution time after a specific time.
Sourcepub fn concurrency_limit(&self) -> Option<usize>
pub fn concurrency_limit(&self) -> Option<usize>
Returns the job’s concurrency limit.
Sourcepub fn misfire_policy(&self) -> MisfirePolicy
pub fn misfire_policy(&self) -> MisfirePolicy
Returns the job’s misfire policy.
Sourcepub async fn run(&self) -> CronResult<()>
pub async fn run(&self) -> CronResult<()>
Runs the lifecycle sequence: on_start → run → on_complete / on_error.
Handles timeouts and retries internally.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for JobItem
impl !UnwindSafe for JobItem
impl Freeze for JobItem
impl Send for JobItem
impl Sync for JobItem
impl Unpin for JobItem
impl UnsafeUnpin for JobItem
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