pub struct SchedulerHandle(/* private fields */);
Expand description
Handle for a Scheduler
, running or not
Implementations§
Source§impl SchedulerHandle
impl SchedulerHandle
Sourcepub fn cancel(&self)
pub fn cancel(&self)
Cancel the Scheduler
(stop any running job)
Examples found in repository?
examples/simple.rs (line 13)
1fn main() {
2 let _once_handle = scheduling::Scheduler::once(|| println!("ONCE")).start();
3
4 let recurring_handle = scheduling::Scheduler::delayed_recurring(
5 std::time::Duration::from_secs(1),
6 std::time::Duration::from_secs(1),
7 || println!("1 SEC ELAPSED"),
8 )
9 .start();
10
11 std::thread::sleep(std::time::Duration::from_secs(5));
12
13 recurring_handle.cancel();
14
15 std::thread::sleep(std::time::Duration::from_secs(5));
16}
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SchedulerHandle
impl RefUnwindSafe for SchedulerHandle
impl Send for SchedulerHandle
impl Sync for SchedulerHandle
impl Unpin for SchedulerHandle
impl UnwindSafe for SchedulerHandle
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