From f712acde86bdbceb766a4a210cbdd45cae5331c2 Mon Sep 17 00:00:00 2001 From: ivmarkov Date: Thu, 19 Oct 2023 10:04:05 +0000 Subject: [PATCH] Correct way to run the executor --- src/main.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f0058834..7c40b79e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -704,6 +704,8 @@ fn test_mqtt_client() -> Result anyhow::Result<()> { + use std::pin::pin; + use async_executor::LocalExecutor; async fn test_tcp_bind(executor: &LocalExecutor<'_>) -> std::io::Result<()> { @@ -743,7 +745,9 @@ fn test_tcp_bind_async() -> anyhow::Result<()> { thread::Builder::new().stack_size(20000).spawn(move || { let executor = LocalExecutor::new(); - async_io::block_on(test_tcp_bind(&executor)).unwrap(); + let fut = &mut pin!(test_tcp_bind(&executor)); + + async_io::block_on(executor.run(fut)).unwrap(); })?; Ok(())