Xuanwo/backon

Use Boxed Fns for when and notify to allow closures

Plecra opened this issue · 1 comments

The notify API only takes fn(...) references right now, but I'd like to be able to write to my UI. I need to use a closure for that.

Instead, the API should use

pub fn notify(self, notify: impl Fn(&E, Duration));

The only downside to this is making the Retry objects 2 words larger, for erased user state. Note that Box<dyn Fn(..)> doesn't allocate for basic fns

Xuanwo commented

Hi, @Plecra, backon has add the feature in a zero cost way, do you still want to have a try?