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
@@ -34,15 +34,15 @@ fn app() -> Element {
|
||||
if val() == "0" {
|
||||
val.set(String::new());
|
||||
}
|
||||
val.write().push_str(num.as_str());
|
||||
val.push_str(num.as_str());
|
||||
};
|
||||
|
||||
let mut input_operator = move |key: &str| val.write().push_str(key);
|
||||
let mut input_operator = move |key: &str| val.push_str(key);
|
||||
|
||||
let handle_key_down_event = move |evt: KeyboardEvent| match evt.key() {
|
||||
Key::Backspace => {
|
||||
if !val().is_empty() {
|
||||
val.write().pop();
|
||||
val.pop();
|
||||
}
|
||||
}
|
||||
Key::Character(character) => match character.as_str() {
|
||||
@@ -104,7 +104,7 @@ fn app() -> Element {
|
||||
}
|
||||
button {
|
||||
class: "calculator-key key-dot",
|
||||
onclick: move |_| val.write().push('.'),
|
||||
onclick: move |_| val.push('.'),
|
||||
"●"
|
||||
}
|
||||
for k in 1..10 {
|
||||
|
||||
Reference in new issue
Block a user