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

Add force_set to Value API #242

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hydra
Copy link
Contributor

@hydra hydra commented Jan 14, 2025

In my 'makerpnp' application which uses a Dynamic<Message>, where the Message enum does not implement PartialEq because some of the values it contains are do not implement PartialEq, I found it very un-ergonomic to use map_mut and have been using the force_set from this PR instead for a while now.

example code from my app:

let ok_button = "Ok".into_button()
    .on_click({
        let message = self.message.clone();
        move |_event| message.force_set(Message::SomeEvent(event_args))
    });

I looked at calling force_set replace, but that already exists for types that implement PartialEq, also in my use-case the caller does not need the old value like set.

This PR also fixes the rustdoc documentation on the set method which didn't seem correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant