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

Make bound event listeners Copy #85

Merged
merged 2 commits into from
May 25, 2023
Merged

Make bound event listeners Copy #85

merged 2 commits into from
May 25, 2023

Conversation

maciejhirsz
Copy link
Owner

This should now be legal:

bind! {
    state:

    let reset = |_| *state = 0;
}

view! {
    // `reset` previously was of `impl Listener<_>` type that made it `!Copy`
    <input onclick={reset} onchange={reset}>
}

}

impl<S, F> Bound<S, F> {
pub fn into_listener<E, O>(self) -> impl Listener<E>
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once return position impl Trait in traits becomes stable this can become part of the IntoListener<E> trait.

@maciejhirsz maciejhirsz merged commit 36d43f4 into master May 25, 2023
@maciejhirsz maciejhirsz deleted the into-listener branch May 25, 2023 09:48
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