pub struct Scheduler { /* private fields */ }Expand description
Bounded local scheduler with cooperative cancellation and clean shutdown.
Implementations§
Source§impl Scheduler
impl Scheduler
Sourcepub fn new(config: SchedulerConfig) -> Result<Self, SchedulerError>
pub fn new(config: SchedulerConfig) -> Result<Self, SchedulerError>
Starts a scheduler coordinator with validated bounds.
Sourcepub fn schedule(
&self,
task: ScheduledTask,
callback: TaskCallback,
) -> Result<TaskHandle, SchedulerError>
pub fn schedule( &self, task: ScheduledTask, callback: TaskCallback, ) -> Result<TaskHandle, SchedulerError>
Registers a task and callback.
Sourcepub fn snapshot(&self) -> SchedulerSnapshot
pub fn snapshot(&self) -> SchedulerSnapshot
Returns current scheduler and task state.
Sourcepub fn shutdown(&self) -> Result<(), SchedulerError>
pub fn shutdown(&self) -> Result<(), SchedulerError>
Stops accepting work, cancels tasks and joins all worker threads.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Scheduler
impl !RefUnwindSafe for Scheduler
impl !UnwindSafe for Scheduler
impl Send for Scheduler
impl Sync for Scheduler
impl Unpin for Scheduler
impl UnsafeUnpin 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