8000 loosen `Fn(Response)` to `FnOnce(Response)` in `fs::load_file` by cyrgani · Pull Request #544 · not-fl3/miniquad · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

loosen Fn(Response) to FnOnce(Response) in fs::load_file #544

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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
0