You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 4, 2022. It is now read-only.
Wrapping the router in a mutex would mean requiring mutual exclusion during the creation of a response future, which is not something I want to do. Is there a reason the Sync bound is a problem?
Currently all route handlers needs to be
Send
,Sync
and'static
, the default hyperExecutor
only requiresSend
and'static
bounds (see this line).The
Sync
bound is currently needed becauseRouterService
holds anArc<Router>
which only implementsSend
if the underlying type is bothSend
ANDSync
.A workaround would be to wrap the router in a
Mutex
:Arc<Mutex<Router>>
. SinceMutex
implementsSend
andSync
for all types that areSend
this should removes the need for allSync
bounds.However this would prevent the user from wrapping a
Router
in anArc
themself:An alternative would be to wrap all the inner fields of
Router
in a struct, wrapped in aMutex
:There may be other solutions, but I'm not aware of them ATM.
The text was updated successfully, but these errors were encountered: