Attach and Launch fairings shouldn't need to be Send + Sync
#522
Labels
deficiency
Something doesn't work as well as it could
Send + Sync
#522
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: