Skip to main content

modo/cron/
meta.rs

1use chrono::{DateTime, Utc};
2
3/// Metadata about the current cron job execution passed to handlers.
4///
5/// Obtain a `Meta` value inside a handler by declaring it as a handler
6/// argument — the scheduler extracts it from the [`CronContext`](super::context::CronContext)
7/// automatically via [`FromCronContext`](super::context::FromCronContext).
8#[derive(Debug, Clone)]
9pub struct Meta {
10    /// Fully qualified type name of the registered handler function.
11    pub name: String,
12    /// Deadline by which the handler must finish, derived from
13    /// [`CronOptions::timeout_secs`](super::scheduler::CronOptions).
14    /// Always `Some` for jobs started through [`SchedulerBuilder`](super::scheduler::SchedulerBuilder).
15    pub deadline: Option<tokio::time::Instant>,
16    /// The scheduled tick time that triggered this execution.
17    pub tick: DateTime<Utc>,
18}