Skip to content

Make bound event listeners Copy#85

Merged
maciejhirsz merged 2 commits intomasterfrom
into-listener
May 25, 2023
Merged

Make bound event listeners Copy#85
maciejhirsz merged 2 commits intomasterfrom
into-listener

Conversation

@maciejhirsz
Copy link
Copy Markdown
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
Copy Markdown
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