Readable and Writable helpers for String, HashMap and HashSet (#4834)
* Add more read/write methods for string signals * add helpers for HashMap and HashSet as well * fix typo * fix conflicting string and str extensions * fix counters example
This commit is contained in:
1 parent
3eecfaa0a7
commit
e4297d0e09
13 files changed
+308
-33
No files matched your search
@@ -38,7 +38,7 @@ fn app() -> Element {
|
||||
|
||||
// And then poll it for new events, adding them to our signal
|
||||
while let Some(Ok(event)) = stream.recv().await {
|
||||
events.write().push(event);
|
||||
events.push(event);
|
||||
}
|
||||
|
||||
anyhow::Ok(())
|
||||
|
||||
@@ -31,23 +31,23 @@ fn app() -> Element {
|
||||
let mut json_responses = use_signal(Vec::new);
|
||||
|
||||
let mut start_text_stream = use_action(move || async move {
|
||||
text_responses.write().clear();
|
||||
text_responses.clear();
|
||||
let mut stream = text_stream(Some(100)).await?;
|
||||
|
||||
while let Some(Ok(text)) = stream.next().await {
|
||||
text_responses.write().push_str(&text);
|
||||
text_responses.write().push('\n');
|
||||
text_responses.push_str(&text);
|
||||
text_responses.push('\n');
|
||||
}
|
||||
|
||||
dioxus::Ok(())
|
||||
});
|
||||
|
||||
let mut start_json_stream = use_action(move || async move {
|
||||
json_responses.write().clear();
|
||||
json_responses.clear();
|
||||
let mut stream = json_stream().await?;
|
||||
|
||||
while let Some(Ok(dog)) = stream.next().await {
|
||||
json_responses.write().push(dog);
|
||||
json_responses.push(dog);
|
||||
}
|
||||
|
||||
dioxus::Ok(())
|
||||
|
||||
Reference in new issue
Block a user