1 | use crate::runtime::task; |
2 | |
3 | #[cfg (test)] |
4 | use std::cell::RefCell; |
5 | |
6 | pub(crate) trait Overflow<T: 'static> { |
7 | fn push(&self, task: task::Notified<T>); |
8 | |
9 | fn push_batch<I>(&self, iter: I) |
10 | where |
11 | I: Iterator<Item = task::Notified<T>>; |
12 | } |
13 | |
14 | #[cfg (test)] |
15 | impl<T: 'static> Overflow<T> for RefCell<Vec<task::Notified<T>>> { |
16 | fn push(&self, task: task::Notified<T>) { |
17 | self.borrow_mut().push(task); |
18 | } |
19 | |
20 | fn push_batch<I>(&self, iter: I) |
21 | where |
22 | I: Iterator<Item = task::Notified<T>>, |
23 | { |
24 | self.borrow_mut().extend(iter); |
25 | } |
26 | } |
27 | |