Try to remove `Send` / `Sync` from `Resource`
torkleyy opened this issue · comments
It might be worth exploring a version of shred that doesn't force anybody using the Dispatcher
, which forces thread-safety on all resources.
I wonder why dispatcher forces Send + Sync
?
If only thread-local systems are added then Send + Sync
shouldn't be required.
Ideally only non-thread-local systems with Fetch<T>
should require T: Sync
, and with FetchMut<T>
- T: Send + Sync
.
This means you need Resources
to implement Sync
. Doesn't mean you can store only Send + Sync
types. Maybe you'd have to implement Sync
manually for Resources
.
I don't think there's any useful solution to this; !Send
are best stored in systems and synchronized with the data in the world, so e.g. processing can happen in parallel.
There's also no construct that allows fast, efficient and type-safe access to !Send
resources.