diff options
Diffstat (limited to 'core/task.rs')
-rw-r--r-- | core/task.rs | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/core/task.rs b/core/task.rs index 46a4c8c26..3e728a08f 100644 --- a/core/task.rs +++ b/core/task.rs @@ -44,6 +44,7 @@ impl<R> Future for JoinHandle<R> { /// Equivalent to [`tokio::task::spawn`], but does not require the future to be [`Send`]. Must only be /// used on a [`RuntimeFlavor::CurrentThread`] executor, though this is only checked when running with /// debug assertions. +#[inline(always)] pub fn spawn<F: Future<Output = R> + 'static, R: 'static>( f: F, ) -> JoinHandle<R> { @@ -60,6 +61,7 @@ pub fn spawn<F: Future<Output = R> + 'static, R: 'static>( /// Equivalent to [`tokio::task::spawn_blocking`]. Currently a thin wrapper around the tokio API, but this /// may change in the future. +#[inline(always)] pub fn spawn_blocking< F: (FnOnce() -> R) + Send + 'static, R: Send + 'static, @@ -89,6 +91,7 @@ impl<R> MaskResultAsSend<R> { } } +#[repr(transparent)] pub struct MaskFutureAsSend<F> { future: F, } @@ -102,6 +105,7 @@ impl<F> MaskFutureAsSend<F> { /// /// You must ensure that the future is actually used on the same /// thread, ie. always use current thread runtime flavor from Tokio. + #[inline(always)] pub unsafe fn new(future: F) -> Self { Self { future } } |