From d059b2bc052c58d623215a6f3ddc199bafb08856 Mon Sep 17 00:00:00 2001 From: Miles Murgaw Date: Sat, 13 May 2023 11:50:24 -0400 Subject: [PATCH 1/2] doc: mention futures-util in use_coroutine hook --- packages/hooks/src/usecoroutine.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/hooks/src/usecoroutine.rs b/packages/hooks/src/usecoroutine.rs index bc97735b9..a6ffd3e4e 100644 --- a/packages/hooks/src/usecoroutine.rs +++ b/packages/hooks/src/usecoroutine.rs @@ -33,6 +33,10 @@ use std::future::Future; /// However, you must plan out your own concurrency and synchronization. If you /// don't care about actions in your app being synchronized, you can use [`use_callback`] /// hook to spawn multiple tasks and run them concurrently. +/// +/// ### Notice +/// In order to use ``rx.next().await``, you will need to extend the ``Stream`` trait (used by ``UnboundedReceiver``) +/// by adding the ``futures-util`` crate as a dependency and adding ``StreamExt`` into scope via ``use futures_util::stream::StreamExt;`` /// /// ## Example /// From 06233ac550a851917b42fae38db4470185fa79ab Mon Sep 17 00:00:00 2001 From: Miles Murgaw Date: Sat, 13 May 2023 12:41:00 -0400 Subject: [PATCH 2/2] fix: rustfmt --- packages/hooks/src/usecoroutine.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hooks/src/usecoroutine.rs b/packages/hooks/src/usecoroutine.rs index a6ffd3e4e..b19a355d0 100644 --- a/packages/hooks/src/usecoroutine.rs +++ b/packages/hooks/src/usecoroutine.rs @@ -33,9 +33,9 @@ use std::future::Future; /// However, you must plan out your own concurrency and synchronization. If you /// don't care about actions in your app being synchronized, you can use [`use_callback`] /// hook to spawn multiple tasks and run them concurrently. -/// +/// /// ### Notice -/// In order to use ``rx.next().await``, you will need to extend the ``Stream`` trait (used by ``UnboundedReceiver``) +/// In order to use ``rx.next().await``, you will need to extend the ``Stream`` trait (used by ``UnboundedReceiver``) /// by adding the ``futures-util`` crate as a dependency and adding ``StreamExt`` into scope via ``use futures_util::stream::StreamExt;`` /// /// ## Example