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

Avoid tuple in Block::call #575

Open
madsmtm opened this issue Feb 4, 2024 · 0 comments
Open

Avoid tuple in Block::call #575

madsmtm opened this issue Feb 4, 2024 · 0 comments
Labels
A-block2 Affects the `block2` crate enhancement New feature or request

Comments

@madsmtm
Copy link
Owner

madsmtm commented Feb 4, 2024

Calling blocks should be possible without having to specify the awkward tuple argument (i.e. block.call((42,))).

Idea for solution (playground), credit to @yury for the idea:

impl<R> Block<dyn Fn() -> R> {
    pub fn call(&self) -> R { unimplemented!() }
}

impl<A, R> Block<dyn Fn(A) -> R> {
    pub fn call(&self, arg0: A) -> R { unimplemented!() }
}

// ...

Though of course, with the fn_traits feature, this would be even prettier.

@madsmtm madsmtm added enhancement New feature or request A-block2 Affects the `block2` crate labels Feb 4, 2024
@madsmtm madsmtm mentioned this issue Feb 4, 2024
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-block2 Affects the `block2` crate enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant