-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Attach and Launch fairings shouldn't need to be Send + Sync
#522
Labels
deficiency
Something doesn't work as well as it could
Comments
SergioBenitez
added a commit
that referenced
this issue
Apr 22, 2018
These changes allow any type that implements `FnOnce`, instead of `Fn`, to be used as attach or launch fairings via `AdHoc`. Furthermore, the `Sync` bound was also lifted. Resolves #522.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
These fairings are called once on the main thread, so the
Send + Sync
bounds are unnecessary. Furthermore, attach fairings are never stored anywhere, so they don't need the'static
bound. This also implies thatAdHoc::on_attach
andAdHoc::on_launch
should accept anF: FnOnce(..)
instead of anFn
.In all, the loosest bounds are:
on_attach
: none (FnOnce
)on_launch
: 'static (FnOnce
)on_request
: Send + Sync + 'static (Fn
)on_response
: Send + Sync + 'static (Fn
)It would be ideal if Rocket imposed the least restrictions.
The text was updated successfully, but these errors were encountered: