wip: consolidation, simplification
This commit is contained in:
1 parent
b56ea6c9a9
commit
70b983d090
17 files changed
+1228
-836
No files matched your search
@@ -1,39 +0,0 @@
|
||||
use crate::innerlude::*;
|
||||
use futures_channel::mpsc::UnboundedSender;
|
||||
|
||||
pub struct TaskHandle {
|
||||
pub(crate) sender: UnboundedSender<SchedulerMsg>,
|
||||
pub(crate) our_id: u64,
|
||||
}
|
||||
|
||||
impl TaskHandle {
|
||||
/// Toggles this coroutine off/on.
|
||||
///
|
||||
/// This method is not synchronous - your task will not stop immediately.
|
||||
pub fn toggle(&self) {
|
||||
self.sender
|
||||
.unbounded_send(SchedulerMsg::Task(TaskMsg::ToggleTask(self.our_id)))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// This method is not synchronous - your task will not stop immediately.
|
||||
pub fn resume(&self) {
|
||||
self.sender
|
||||
.unbounded_send(SchedulerMsg::Task(TaskMsg::ResumeTask(self.our_id)))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// This method is not synchronous - your task will not stop immediately.
|
||||
pub fn stop(&self) {
|
||||
self.sender
|
||||
.unbounded_send(SchedulerMsg::Task(TaskMsg::ToggleTask(self.our_id)))
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
/// This method is not synchronous - your task will not stop immediately.
|
||||
pub fn restart(&self) {
|
||||
self.sender
|
||||
.unbounded_send(SchedulerMsg::Task(TaskMsg::ToggleTask(self.our_id)))
|
||||
.unwrap()
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user