Skip to content

Conversation

@cyrgani
Copy link
Contributor

@cyrgani cyrgani commented Apr 13, 2025

Fixes #433.
This does not break any code, but allows more code to compile, as stated in that issue and in the Fn docs:

Since both FnMut and FnOnce are supertraits of Fn, any instance of Fn can be used as a parameter where a FnMut or FnOnce is expected.

Use Fn as a bound when you want to accept a parameter of function-like type and need to call it repeatedly and without mutating state (e.g., when calling it concurrently). If you do not need such strict requirements, use FnMut or FnOnce as bounds.

@cyrgani cyrgani changed the title loosen Fn(Response) to FnArgs(Response) in fs::load_file loosen Fn(Response) to FnOnce(Response) in fs::load_file Apr 13, 2025
@cyrgani cyrgani force-pushed the fn-once-load-file branch from 04ed31e to 0cf66eb Compare April 13, 2025 21:13
@cyrgani cyrgani force-pushed the fn-once-load-file branch from 0cf66eb to e55570f Compare April 13, 2025 21:15
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.

Loosen Fn trait bounds on fs::load_file

1 participant