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

Allow functions returning unit in use_effect #2844

Closed
WorldSEnder opened this issue Aug 25, 2022 Discussed in #2843 · 0 comments · Fixed by #2849
Closed

Allow functions returning unit in use_effect #2844

WorldSEnder opened this issue Aug 25, 2022 Discussed in #2843 · 0 comments · Fixed by #2849
Labels
A-yew Area: The main yew crate feature-request A feature request
Milestone

Comments

@WorldSEnder
Copy link
Member

Discussed in #2843

Originally posted by arniu August 25, 2022
sample

trait TearDown: Sized {
    fn tear_down(self) {}
}

impl TearDown for () {}

impl<F: FnOnce()> TearDown for F {
    fn tear_down(self) {
        self()
    }
}

fn use_effect<F, R>(f: F)
where
    F: Fn() -> R,
    R: TearDown,
{ todo!() }
@WorldSEnder WorldSEnder added feature-request A feature request A-yew Area: The main yew crate labels Aug 25, 2022
@hamza1311 hamza1311 added this to the v0.20 milestone Aug 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-yew Area: The main yew crate feature-request A feature request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants