Module delay_timer::prelude
source · Expand description
A “prelude” for users of the delay-timer
crate.
This prelude is similar to the standard library’s prelude in that you’ll almost always want to import its entire contents, but unlike the standard library’s prelude you’ll have to do so manually:
use delay_timer::prelude::*;
The prelude may grow over time as additional items see ubiquitous use.
Re-exports
pub use crate::entity::timestamp;
pub use crate::entity::timestamp_micros;
pub use crate::entity::DelayTimer;
pub use crate::entity::DelayTimerBuilder;
pub use crate::timer::task::TaskContext;
pub use crate::timer::task::FrequencyCronStr as Frequency;
pub use crate::timer::task::ScheduleIteratorTimeZone;
pub use crate::timer::task::Task;
pub use crate::timer::task::TaskBuilder;
pub use crate::timer::timer_core::FinishOutput;
pub use crate::timer::timer_core::FinishTaskBody;
pub use crate::timer::timer_core::TimerEvent;
pub use crate::utils::convenience::cron_expression_grammatical_candy::CandyCron;
pub use crate::utils::convenience::cron_expression_grammatical_candy::CandyCronStr;
pub use crate::utils::convenience::cron_expression_grammatical_candy::CandyFrequency;
pub use crate::utils::convenience::functions::create_default_delay_task_handler;
pub use crate::utils::convenience::functions::create_delay_task_handler;
pub use crate::utils::status_report::PublicEvent;
status-report
pub use cron_clock;
pub use smol::channel;
pub use crate::error::*;
Modules
- Combinators for the
Future
trait. - State of the task instance.
Macros
- Construct an ad-hoc error from a string or existing non-
anyhow
error value.
Structs
- The time zone with fixed offset, from UTC-23:59:59 to UTC+23:59:59.
- instance of task running.
- The local timescale. This is implemented via the standard
time
crate. - A spawned task.
- Public instance of task running.
- Chain of task run instances. For User access to Running-Task’s instance.
- An owned permission to join on a task (await its termination).
- The UTC time zone. This is the most efficient time zone when you don’t need the local time. It is also used as an offset (which is also a dummy type).
Traits
- You can implement this trait for your type
T
, and then you can define the function that returns theBox<T> as Box<dyn DelayTaskHandler>
closure, which can be wrapped by the TaskBuilder and then thrown into the time wheel for constant rotation. - The time zone.
Functions
- Spawns a task onto the global executor (single-threaded by default).
- Spawns a new asynchronous task, returning a
JoinHandle
for it. - Waits until
duration
has elapsed. - Runs blocking code on a thread pool.
- Runs the provided closure on a thread where blocking is acceptable.
Type Aliases
Result<T, Error>
- State of the task run instance.