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:
@ -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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user