1 use crate::runtime::task::{self, Task};
2 
3 /// `task::Schedule` implementation that does nothing. This is unique to the
4 /// blocking scheduler as tasks scheduled are not really futures but blocking
5 /// operations.
6 ///
7 /// We avoid storing the task by forgetting it in `bind` and re-materializing it
8 /// in `release.
9 pub(crate) struct NoopSchedule;
10 
11 impl task::Schedule for NoopSchedule {
bind(_task: Task<Self>) -> NoopSchedule12     fn bind(_task: Task<Self>) -> NoopSchedule {
13         // Do nothing w/ the task
14         NoopSchedule
15     }
16 
release(&self, _task: &Task<Self>) -> Option<Task<Self>>17     fn release(&self, _task: &Task<Self>) -> Option<Task<Self>> {
18         None
19     }
20 
schedule(&self, _task: task::Notified<Self>)21     fn schedule(&self, _task: task::Notified<Self>) {
22         unreachable!();
23     }
24 }
25