From ab16c865bb8f1680d6c93198b241419cafa0e9aa Mon Sep 17 00:00:00 2001 From: Aaron Weiss Date: Wed, 24 Jan 2018 12:13:33 +0100 Subject: [PATCH] Added a function to spawn arbitrary futures on a reactor (i.e. opt-in "full" tokio support). --- src/client/reactor.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/client/reactor.rs b/src/client/reactor.rs index ee8efdd..b255009 100644 --- a/src/client/reactor.rs +++ b/src/client/reactor.rs @@ -42,6 +42,12 @@ impl IrcReactor { }))); } + pub fn register_future( + &mut self, future: F + ) where F: Future + '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() {