Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AddAssign and friends for Signal<T> where T: Copy #384

Closed
lukechu10 opened this issue Mar 13, 2022 · 0 comments · Fixed by #397
Closed

Implement AddAssign and friends for Signal<T> where T: Copy #384

lukechu10 opened this issue Mar 13, 2022 · 0 comments · Fixed by #397
Labels
A-ergonomics Area: API ergonomics A-reactivity Area: reactivity and state handling C-enhancement Category: new feature or improvement to existing feature D-easy Difficulty: easy good first issue Good for newcomers

Comments

@lukechu10
Copy link
Member

This makes it more ergonomic for simple cases where we want to increment/decrement a Signal.
e.g. instead of writing this:

counter.set(*counter.get() + 1);

we can write this:

counter += 1;

This should only be implemented for types where T: Copy because we don't want to implicitly clone values behind the scenes.

@lukechu10 lukechu10 added C-enhancement Category: new feature or improvement to existing feature good first issue Good for newcomers A-reactivity Area: reactivity and state handling A-ergonomics Area: API ergonomics D-easy Difficulty: easy labels Mar 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-ergonomics Area: API ergonomics A-reactivity Area: reactivity and state handling C-enhancement Category: new feature or improvement to existing feature D-easy Difficulty: easy good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant