Skip to content

Alternative InvertibleComponentIdSet#24809

Open
chescock wants to merge 1 commit into
bevyengine:mainfrom
chescock:InvertibleSet
Open

Alternative InvertibleComponentIdSet#24809
chescock wants to merge 1 commit into
bevyengine:mainfrom
chescock:InvertibleSet

Conversation

@chescock

Copy link
Copy Markdown
Contributor

Objective

Allow Access to be inspected for EntityMutExcept<B> queries.

Simplify the code that handles inverted access, particularly the for loops in is_compatible, is_subset, and get_conflicts.

Solution

Create an enum InvertibleComponentIdSet with separate variants for finite and unbounded sets, and use it in Access.

Alternative to #24771 and #24789

@chescock chescock added A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Jun 29, 2026
@github-project-automation github-project-automation Bot moved this to Needs SME Triage in ECS Jun 29, 2026

/// If this is a finite set, returns the set.
/// If this is an unbounded set, returns `None`.
pub fn as_finite_set(&self) -> Option<&ComponentIdSet> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add as_exclusion_set() that returns None for Included, and the set for Excluded

/// Removes all [`ComponentId`]s from the set.
#[inline]
pub fn clear(&mut self) {
*self = Self::new();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is re alloc'ing okay for perf?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ECS Entities, components, systems, and events C-Code-Quality A section of code that is hard to understand or change C-Usability A targeted quality-of-life change that makes Bevy easier to use S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: Needs SME Triage

Development

Successfully merging this pull request may close these issues.

2 participants