pub struct ScheduledTaskConfig {
pub name: String,
pub initial_delay: Duration,
pub period: Duration,
pub mode: ScheduleMode,
pub max_run_time: Option<Duration>,
}Expand description
Name, cadence and run limit of one schedule.
The mode chosen by the constructor is the only input that decides how runs are timed and whether they may overlap. The policy passed at registration must agree with it.
Fields§
§name: StringThe name value.
initial_delay: DurationDelay before the first run; zero means the first run is immediately due.
period: DurationDelay between completions or fixed-rate tick interval, according to mode.
mode: ScheduleModeThe mode value.
max_run_time: Option<Duration>Optional limit on each asynchronous run, starting when it is polled.
Expiry drops the run future; it cannot interrupt blocking work already started by that future.
Implementations§
Source§impl ScheduledTaskConfig
impl ScheduledTaskConfig
Sourcepub fn fixed_delay(name: impl Into<String>, period: Duration) -> Self
pub fn fixed_delay(name: impl Into<String>, period: Duration) -> Self
Creates a schedule that waits period after each run completes.
Sourcepub fn fixed_rate_no_overlap(name: impl Into<String>, period: Duration) -> Self
pub fn fixed_rate_no_overlap(name: impl Into<String>, period: Duration) -> Self
Creates a schedule that ticks every period and never overlaps runs.
Sourcepub fn fixed_rate(name: impl Into<String>, period: Duration) -> Self
pub fn fixed_rate(name: impl Into<String>, period: Duration) -> Self
Creates a schedule that ticks every period and overlaps runs up to
the bound of its policy.
Sourcepub fn with_initial_delay(self, initial_delay: Duration) -> Self
pub fn with_initial_delay(self, initial_delay: Duration) -> Self
Sets the delay before the first run.