Experiment with call syntax only working for copy types

This commit is contained in:
Jonathan Kelley committed 2024-01-15 21:12:44 -08:00
1 parent bb750f5336
commit 33bba24867
19 files changed
+52 -76

No files matched your search

+3 -3
View File
@@ -14,7 +14,7 @@ fn app() -> Element {
// Signals are backed by a runtime that is designed to deeply integrate with Dioxus apps
use_future(|| async move {
loop {
if running.value() {
if running.cloned() {
count += 1;
}
tokio::time::sleep(Duration::from_millis(400)).await;
@@ -26,11 +26,11 @@ fn app() -> Element {
button { onclick: move |_| count += 1, "Up high!" }
button { onclick: move |_| count -= 1, "Down low!" }
button { onclick: move |_| running.toggle(), "Toggle counter" }
button { onclick: move |_| saved_values.push(count.value().to_string()), "Save this value" }
button { onclick: move |_| saved_values.push(count.cloned().to_string()), "Save this value" }
button { onclick: move |_| saved_values.write().clear(), "Clear saved values" }
// We can do boolean operations on the current signal value
if count.value() > 5 {
if count() > 5 {
h2 { "High five!" }
}