runtime: drop now not required Send and static restrictions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2020-01-20 14:09:24 +01:00
parent d973aa827c
commit 650e052299
1 changed files with 2 additions and 11 deletions

View File

@ -76,12 +76,7 @@ pub fn block_in_place<R>(fut: impl FnOnce() -> R) -> R {
} }
/// Block on a future in this thread. /// Block on a future in this thread.
pub fn block_on<R, F>(fut: F) -> R pub fn block_on<F: Future>(fut: F) -> F::Output {
where
R: Send + 'static,
F: Future<Output = R> + Send,
{
if is_in_tokio() { if is_in_tokio() {
// inside a tokio worker we need to tell tokio that we're about to really block: // inside a tokio worker we need to tell tokio that we're about to really block:
tokio::task::block_in_place(move || futures::executor::block_on(fut)) tokio::task::block_in_place(move || futures::executor::block_on(fut))
@ -122,10 +117,6 @@ where
/// This used to be our tokio main entry point. Now this just calls out to `block_on` for /// This used to be our tokio main entry point. Now this just calls out to `block_on` for
/// compatibility, which will perform all the necessary tasks on-demand anyway. /// compatibility, which will perform all the necessary tasks on-demand anyway.
pub fn main<F>(fut: F) -> F::Output pub fn main<F: Future>(fut: F) -> F::Output {
where
F: Future + Send,
F::Output: Send + 'static,
{
block_on(fut) block_on(fut)
} }