Update more examples, add css for more examples

This commit is contained in:
Jonathan Kelley committed 2024-02-14 13:48:58 -08:00
1 parent 60b78668ac
commit cfc119cce2
19 files changed
+228 -101

No files matched your search

+5
View File
@@ -1,3 +1,5 @@
//! Handle async streams using use_future and awaiting the next value.
use dioxus::prelude::*;
use futures_util::{future, stream, Stream, StreamExt};
use std::time::Duration;
@@ -10,8 +12,11 @@ fn app() -> Element {
let mut count = use_signal(|| 10);
use_future(move || async move {
// Create the stream.
// This could be a network request, a file read, or any other async operation.
let mut stream = some_stream();
// Await the next value from the stream.
while let Some(second) = stream.next().await {
count.set(second);
}