Browse Source

Added mention of StreamExt trait extension. (#886)

marcerhans 2 years ago
parent
commit
f0c9dadf77
1 changed files with 8 additions and 0 deletions
  1. 8 0
      docs/guide/src/en/async/use_coroutine.md

+ 8 - 0
docs/guide/src/en/async/use_coroutine.md

@@ -92,6 +92,8 @@ With Coroutines, we can centralize our async logic. The `rx` parameter is an Cha
 
 
 
 
 ```rust
 ```rust
+use futures_util::stream::StreamExt;
+
 enum ProfileUpdate {
 enum ProfileUpdate {
     SetUsername(String),
     SetUsername(String),
     SetAge(i32)
     SetAge(i32)
@@ -117,6 +119,10 @@ cx.render(rsx!{
 })
 })
 ```
 ```
 
 
+
+> Note: In order to use/run the `rx.next().await` statement you will need to extend the [`Stream`] trait (used by [`UnboundedReceiver`]) by adding 'futures_util' as a dependency to your project and adding the `use futures_util::stream::StreamExt;`.
+
+
 For sufficiently complex apps, we could build a bunch of different useful "services" that loop on channels to update the app.
 For sufficiently complex apps, we could build a bunch of different useful "services" that loop on channels to update the app.
 
 
 ```rust
 ```rust
@@ -164,6 +170,8 @@ fn Banner(cx: Scope) -> Element {
 Now, in our sync service, we can structure our state however we want. We only need to update the view values when ready.
 Now, in our sync service, we can structure our state however we want. We only need to update the view values when ready.
 
 
 ```rust
 ```rust
+use futures_util::stream::StreamExt;
+
 enum SyncAction {
 enum SyncAction {
     SetUsername(String),
     SetUsername(String),
 }
 }