Allow NonSend components
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 22h
- Merged PRs (30d)
- 161
Description
## What problem does this solve or what need does it fill?
Allow data that is not `Send` to be stored in components, increasing API flexibility.
This is particularly useful for structs that contain a `Cell` or similar, allowing for interior (within-system) parallelization.
## What solution would you like?
Mirror / share the `NonSend` resource API. Systems that have at least one `NonSend` component or resource access can only run on the main thread to ensure that the data does not have to be passed between threads.
Reusing `NonSend` for both resources and components would be the best naming scheme for this if possible.
## What alternative(s) have you considered?
Store a reference to a `NonSend` resource maybe? Just Don't Do That.
## Additional context
This will impact the `Component` trait (#1843), as it will not include `Send + Sync` trait bounds. Instead, those will be limited to using components in a parallelizable fashion.
Contributor guide
Assessment
This issue has not been assessed yet.