diff --git a/rust_crate/src/channel.rs b/rust_crate/src/channel.rs index a71c6d2b..7cf0cd6d 100644 --- a/rust_crate/src/channel.rs +++ b/rust_crate/src/channel.rs @@ -52,14 +52,13 @@ impl SignalSender { impl SignalReceiver { /// Asynchronously receives the next message from the queue. Only the active /// receiver is allowed to receive messages. If there are no messages in the - /// queue, the receiver will wait until a new message is sent. If this receiver - /// is not active, it will return `None`. - pub async fn recv(&self) -> Option { + /// queue, the receiver will wait until a new message is sent. + /// If this receiver is not active, the future will return `None`. + pub fn recv(&self) -> impl Future> { RecvFuture { inner: self.inner.clone(), receiver_id: self.id, // Pass the receiver's ID to the future } - .await } } diff --git a/rust_crate/src/shutdown.rs b/rust_crate/src/shutdown.rs index c946c38d..e5c6e834 100644 --- a/rust_crate/src/shutdown.rs +++ b/rust_crate/src/shutdown.rs @@ -29,8 +29,8 @@ pub struct ShutdownEvents { /// Awaiting this receiver in the async main Rust function /// is necessary to prevent the async runtime in Rust from /// finishing immediately. -pub async fn dart_shutdown() { - SHUTDOWN_EVENTS.dart_stopped.wait_async().await; +pub fn dart_shutdown() -> impl Future { + SHUTDOWN_EVENTS.dart_stopped.wait_async() } /// Synchronization primitive that allows