Skip to content

Avoid tuple in Block::call #575

Open
@madsmtm

Description

@madsmtm

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-block2Affects the `block2` crateenhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions