rocketmq_rust/
schedule.rs1pub mod executor;
18pub mod scheduler;
19pub mod task;
20pub mod trigger;
21
22use std::error::Error;
23use std::fmt;
24
25pub use executor::ExecutorPool;
26pub use task::Task;
27pub use task::TaskContext;
28pub use task::TaskResult;
29pub use task::TaskStatus;
30
31#[derive(Debug)]
33pub enum SchedulerError {
34 TaskNotFound(String),
35 TaskAlreadyExists(String),
36 ExecutorError(String),
37 TriggerError(String),
38 SystemError(String),
39}
40
41impl fmt::Display for SchedulerError {
42 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
43 match self {
44 SchedulerError::TaskNotFound(id) => write!(f, "Task not found: {id}"),
45 SchedulerError::TaskAlreadyExists(id) => write!(f, "Task already exists: {id}"),
46 SchedulerError::ExecutorError(msg) => write!(f, "Executor error: {msg}"),
47 SchedulerError::TriggerError(msg) => write!(f, "Trigger error: {msg}"),
48 SchedulerError::SystemError(msg) => write!(f, "System error: {msg}"),
49 }
50 }
51}
52
53impl Error for SchedulerError {}
54
55pub type SchedulerResult<T> = Result<T, SchedulerError>;