Skip to content

Allow NonSend components #2486

@alice-i-cecile

Description

@alice-i-cecile

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-FeatureA new feature, making something new possibleX-ControversialThere is active debate or serious implications around merging this PR

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions