Open madsmtm opened 3 months ago
Calling blocks should be possible without having to specify the awkward tuple argument (i.e. block.call((42,))).
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.
fn_traits
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:
Though of course, with the
fn_traits
feature, this would be even prettier.