浏览代码

Added mention of StreamExt trait extension. (#886)

marcerhans 2 年之前
父节点
当前提交
f0c9dadf77
共有 1 个文件被更改,包括 8 次插入0 次删除
  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
+use futures_util::stream::StreamExt;
+
 enum ProfileUpdate {
     SetUsername(String),
     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.
 
 ```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.
 
 ```rust
+use futures_util::stream::StreamExt;
+
 enum SyncAction {
     SetUsername(String),
 }