Added a function to spawn arbitrary futures on a reactor (i.e. opt-in "full" tokio support).
This commit is contained in:
parent
233eab6969
commit
ab16c865bb
1 changed files with 6 additions and 0 deletions
|
@ -42,6 +42,12 @@ impl IrcReactor {
|
|||
})));
|
||||
}
|
||||
|
||||
pub fn register_future<F>(
|
||||
&mut self, future: F
|
||||
) where F: Future<Item = (), Error = error::Error> + 'static {
|
||||
self.handlers.push(Box::new(future))
|
||||
}
|
||||
|
||||
pub fn run(&mut self) -> error::Result<()> {
|
||||
let mut handlers = Vec::new();
|
||||
while let Some(handler) = self.handlers.pop() {
|
||||
|
|
Loading…
Reference in a new issue