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

Unwrap Mutex from broken_link_callback #484

Merged
merged 2 commits into from
Nov 7, 2024

Conversation

liamwhite
Copy link
Contributor

While working on #481 I realized that the same principle of making a dyn trait instead of a FnMut could be applied to the broken link callback. This PR implements an API break for that, which does the following:

  • removes the Mutex wrapper, allowing the link callback to be lock-free if the underlying function is also lock-free
  • makes it easier write the callback if it is a plain Fn (you can still use interior mutability within like Arc<Mutex> if you need it)
  • replaces a more complicated explicit Debug impl with a single simpler explicit Debug impl
  • simplifies a little bit of the lifetime soup from the Options struct

@kivikakk
Copy link
Owner

kivikakk commented Nov 4, 2024

Thank you! I plan to review this and your other PR this week; been flat out!

@kivikakk
Copy link
Owner

kivikakk commented Nov 7, 2024

Thank you, this is awesome!

@kivikakk kivikakk merged commit f4853af into kivikakk:main Nov 7, 2024
20 checks passed
@liamwhite liamwhite deleted the broken-link-trait branch November 7, 2024 03:29
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.

2 participants