pub struct Scheduler { /* private fields */ }Expand description
Session-scoped cron scheduler.
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(session_id: impl Into<String>) -> Self
pub fn new(session_id: impl Into<String>) -> Self
Create an empty scheduler bound to session_id. Honors the
CLAUDE_DISABLE_VAR / ALIAS_DISABLE_VAR env vars.
pub fn with_cap(session_id: impl Into<String>, cap: usize) -> Self
Sourcepub fn restore(session_id: impl Into<String>) -> Self
pub fn restore(session_id: impl Into<String>) -> Self
Restore tasks from disk for session_id. Tasks that have already
expired are pruned during the restore.
pub fn session_id(&self) -> &str
pub fn is_disabled(&self) -> bool
pub fn cap(&self) -> usize
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn create(
&mut self,
schedule: Schedule,
prompt: impl Into<String>,
recurring: bool,
) -> Result<TaskId, SchedulerError>
pub fn create( &mut self, schedule: Schedule, prompt: impl Into<String>, recurring: bool, ) -> Result<TaskId, SchedulerError>
Schedule a new task.
recurring=false makes the task one-shot — it’s removed after firing.
recurring=true is only meaningful for Schedule::Cron and
Schedule::Dynamic; for Schedule::Once it is treated as
one-shot regardless.
pub fn list(&self) -> Vec<&Task>
pub fn delete(&mut self, id: &TaskId) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Scheduler
impl RefUnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin for Scheduler
impl UnwindSafe for Scheduler
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