-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Relaxed runner type from Fn
to FnOnce
#8961
Conversation
Welcome, new contributor! Please make sure you've read our contributing guide and we look forward to reviewing your pull request shortly ✨ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes sense, although I would expect that almost all use cases meet the tighter bounds.
What motivated this?
Aha, the linked PR provides a good motivation :D |
@nakedible: does this PR look right to you as well? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct and adheres exactly to documentation of set_runner
which says:
The runner function
run_fn
is called only once by [App::run
].
Also, the code that actually calls this:
let runner = std::mem::replace(&mut app.runner, Box::new(run_once));
(runner)(app);
Objective
Relax unnecessary type restrictions on
App.runner
function.Solution
Changed the type of
App.runner
fromFn(App)
toFnOnce(App)
.