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

FeatureSuggestion: FnMut for closures #20

Closed
vron opened this issue Dec 20, 2022 · 2 comments
Closed

FeatureSuggestion: FnMut for closures #20

vron opened this issue Dec 20, 2022 · 2 comments

Comments

@vron
Copy link

vron commented Dec 20, 2022

Hi,

I have found myself a few times using roots (nice crate! thx!) in situations where:

  • Each step of the iteration involves running agains a large structure
  • I can re-evaluate my target function by doing minor modificaitons to my large structure

However, since e..g roots::find_root_brent requires a Fn I cannot pass a closure which captures a &mut ref to my struct and modify it in each iteration - instead I have to clone it every time to get a Fn closure instead of FnMut.

Would it be a good idea to accept FnMut closures for all the root functions or am I missing something?

@vorot
Copy link
Owner

vorot commented Dec 20, 2022

It looks like a good idea. A pull request for this feature can be merged on a short notice.

@vorot
Copy link
Owner

vorot commented Dec 21, 2022

done, it was easy.

@vorot vorot closed this as completed Dec 21, 2022
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

No branches or pull requests

2 participants