From 1300a6d4e07f4b2ef786b9380d0fd35355dcc6e7 Mon Sep 17 00:00:00 2001 From: Matt Johnston Date: Sun, 2 Jun 2024 22:40:27 +0800 Subject: [PATCH] Remove noasync --- src/lib.rs | 1 - src/noasync.rs | 29 ----------------------------- 2 files changed, 30 deletions(-) delete mode 100644 src/noasync.rs diff --git a/src/lib.rs b/src/lib.rs index 9a944f5..403ce59 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -46,7 +46,6 @@ mod runner; mod termmodes; mod ssh_chapoly; mod traffic; -mod noasync; use conn::DispatchEvent; diff --git a/src/noasync.rs b/src/noasync.rs deleted file mode 100644 index ee087ef..0000000 --- a/src/noasync.rs +++ /dev/null @@ -1,29 +0,0 @@ -#[allow(unused_imports)] -use { - crate::error::{Error, Result, TrapBug}, - log::{debug, error, info, log, trace, warn}, -}; - -use crate::*; - -use core::task::{Context, Poll}; -use core::future::Future; - -#[derive(Debug)] -pub struct PendingAwait; - -/// Runs an async function that is not expected to `.await`. -/// -/// Returns `Err(PendingAwait)` if the Future attempts to perform an asynchronous operation. -/// This is intended to be used by non-async applications to wrap a call to [`Runner::progress()`], -/// where all [`CliBehaviour`] or [`ServBehaviour`] callback implementations are known to be non-awaiting. -pub fn non_async(f: F) -> Result where F: Future { - futures::pin_mut!(f); - - let w = futures::task::noop_waker(); - - match f.poll(&mut Context::from_waker(&w)) { - Poll::Ready(r) => Ok(r), - Poll::Pending => Err(PendingAwait), - } -}