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
@@ -56,7 +56,7 @@ fn app() -> Element {
|
||||
input {
|
||||
r#type: "number",
|
||||
value: "{i}",
|
||||
onmounted: move |cx| elements.write().push(cx.data()),
|
||||
onmounted: move |cx| elements.push(cx.data()),
|
||||
oninput: move |_| running.set(false),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,12 @@ fn app() -> Element {
|
||||
for file in files {
|
||||
let filename = file.name();
|
||||
if let Ok(contents) = file.read_string().await {
|
||||
files_uploaded.write().push(UploadedFile {
|
||||
files_uploaded.push(UploadedFile {
|
||||
name: filename,
|
||||
contents,
|
||||
});
|
||||
} else {
|
||||
files_uploaded.write().push(UploadedFile {
|
||||
files_uploaded.push(UploadedFile {
|
||||
name: filename,
|
||||
contents: "Failed to read file".into(),
|
||||
});
|
||||
@@ -45,7 +45,7 @@ fn app() -> Element {
|
||||
|
||||
h1 { "File Upload Example" }
|
||||
p { "Drop a .txt, .rs, or .js file here to read it" }
|
||||
button { onclick: move |_| files_uploaded.write().clear(), "Clear files" }
|
||||
button { onclick: move |_| files_uploaded.clear(), "Clear files" }
|
||||
|
||||
div {
|
||||
label { r#for: "directory-upload", "Enable directory upload" }
|
||||
|
||||
@@ -15,7 +15,7 @@ fn app() -> Element {
|
||||
let handle = use_coroutine(move |mut rx: UnboundedReceiver<String>| async move {
|
||||
use futures_util::StreamExt;
|
||||
while let Some(message) = rx.next().await {
|
||||
emails_sent.write().push(message);
|
||||
emails_sent.push(message);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user