From d03c736b4c7d205856a4f64dc5640f8a7c76d9fa Mon Sep 17 00:00:00 2001 From: manuels Date: Wed, 26 Jul 2017 17:33:09 +0200 Subject: [PATCH] Add documentation about panics to {Handle, Remote}::spawn{fn} --- src/reactor/mod.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/reactor/mod.rs b/src/reactor/mod.rs index 39c490a8c..3e92b3b76 100644 --- a/src/reactor/mod.rs +++ b/src/reactor/mod.rs @@ -621,6 +621,12 @@ impl Remote { /// /// Note that while the closure, `F`, requires the `Send` bound as it might /// cross threads, the future `R` does not. + /// + /// # Panics + /// + /// This method will **not** catch panics from polling the future `f`. If + /// the future panics then it's the responsibility of the caller to catch + /// that panic and handle it as appropriate. pub fn spawn(&self, f: F) where F: FnOnce(&Handle) -> R + Send + 'static, R: IntoFuture, @@ -689,6 +695,12 @@ impl Handle { } /// Spawns a new future on the event loop this handle is associated with. + /// + /// # Panics + /// + /// This method will **not** catch panics from polling the future `f`. If + /// the future panics then it's the responsibility of the caller to catch + /// that panic and handle it as appropriate. pub fn spawn(&self, f: F) where F: Future + 'static, { @@ -705,6 +717,12 @@ impl Handle { /// for running a closure wrapped in `futures::lazy`. It will spawn the /// function `f` provided onto the event loop, and continue to run the /// future returned by `f` on the event loop as well. + /// + /// # Panics + /// + /// This method will **not** catch panics from polling the future `f`. If + /// the future panics then it's the responsibility of the caller to catch + /// that panic and handle it as appropriate. pub fn spawn_fn(&self, f: F) where F: FnOnce() -> R + 'static, R: IntoFuture + 'static,