1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-27 06:09:02 +02:00

express spawn fn as spawn fut (#256)

This commit is contained in:
Rob Ede
2021-01-29 15:16:30 +00:00
committed by GitHub
parent 2924419905
commit 1b35ff8ee6
8 changed files with 130 additions and 111 deletions

View File

@ -25,18 +25,6 @@ pub use self::runtime::Runtime;
pub use self::system::System;
pub use self::worker::Worker;
/// Spawns a future on the current [Arbiter].
///
/// # Panics
/// Panics if Actix system is not running.
#[inline]
pub fn spawn<Fut>(f: Fut) -> JoinHandle<()>
where
Fut: Future<Output = ()> + 'static,
{
tokio::task::spawn_local(f)
}
pub mod signal {
//! Asynchronous signal handling (Tokio re-exports).
@ -72,3 +60,15 @@ pub mod task {
pub use tokio::task::{spawn_blocking, yield_now, JoinHandle};
}
/// Spawns a future on the current [Worker].
///
/// # Panics
/// Panics if Actix system is not running.
#[inline]
pub fn spawn<Fut>(f: Fut) -> JoinHandle<()>
where
Fut: Future<Output = ()> + 'static,
{
tokio::task::spawn_local(f)
}