mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-10-01 12:20:39 +00:00
Merge pull request #236 from manuels/patch-1
Add documentation about panics to {Handle, Remote}::spawn{fn}
This commit is contained in:
commit
2a71ef8b13
@ -621,6 +621,12 @@ impl Remote {
|
|||||||
///
|
///
|
||||||
/// Note that while the closure, `F`, requires the `Send` bound as it might
|
/// Note that while the closure, `F`, requires the `Send` bound as it might
|
||||||
/// cross threads, the future `R` does not.
|
/// 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<F, R>(&self, f: F)
|
pub fn spawn<F, R>(&self, f: F)
|
||||||
where F: FnOnce(&Handle) -> R + Send + 'static,
|
where F: FnOnce(&Handle) -> R + Send + 'static,
|
||||||
R: IntoFuture<Item=(), Error=()>,
|
R: IntoFuture<Item=(), Error=()>,
|
||||||
@ -689,6 +695,12 @@ impl Handle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Spawns a new future on the event loop this handle is associated with.
|
/// 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<F>(&self, f: F)
|
pub fn spawn<F>(&self, f: F)
|
||||||
where F: Future<Item=(), Error=()> + 'static,
|
where F: Future<Item=(), Error=()> + 'static,
|
||||||
{
|
{
|
||||||
@ -705,6 +717,12 @@ impl Handle {
|
|||||||
/// for running a closure wrapped in `futures::lazy`. It will spawn the
|
/// for running a closure wrapped in `futures::lazy`. It will spawn the
|
||||||
/// function `f` provided onto the event loop, and continue to run the
|
/// function `f` provided onto the event loop, and continue to run the
|
||||||
/// future returned by `f` on the event loop as well.
|
/// 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<F, R>(&self, f: F)
|
pub fn spawn_fn<F, R>(&self, f: F)
|
||||||
where F: FnOnce() -> R + 'static,
|
where F: FnOnce() -> R + 'static,
|
||||||
R: IntoFuture<Item=(), Error=()> + 'static,
|
R: IntoFuture<Item=(), Error=()> + 'static,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user