Skip to content

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

Merged
Xuanwo merged 5 commits intoXuanwo:mainfrom
BlueGlassBlock:box-fn
May 19, 2023
Merged

feat: Allow FnMut(..) on notify and when#54
Xuanwo merged 5 commits intoXuanwo:mainfrom
BlueGlassBlock:box-fn

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.

@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