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

feat: Allow FnMut(..) on notify and when #54

Merged
merged 5 commits into from
May 19, 2023
Merged

feat: Allow FnMut(..) on notify and when #54

merged 5 commits into from
May 19, 2023

Conversation

BlueGlassBlock
Copy link
Contributor

Resolved #39.

This PR allows users to use closures as notify and when functions, so that they can access other variables, or modify them with a ownership sharing pointer like Rc or Arc.

src/blocking_retry.rs Outdated Show resolved Hide resolved
@BlueGlassBlock BlueGlassBlock changed the title feat: Use Box<dyn FnMut(..)> to wrap notify and when feat: Allow FnMut(..) on notify and when May 19, 2023
@BlueGlassBlock
Copy link
Contributor Author

I thought for a while and done the job in #55 with less lines and no Box 😄

Copy link
Owner

@Xuanwo Xuanwo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bravo!

@Xuanwo Xuanwo marked this pull request as ready for review May 19, 2023 05:06
@Xuanwo
Copy link
Owner

Xuanwo commented May 19, 2023

Hi, @BlueGlassBlock would you like to add a new test case to make sure this PR works as expected?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use Boxed Fns for when and notify to allow closures
2 participants