Skip to content

Consider letting SystemState::get_manual take an immutable reference to self? Similar to QueryState::get_manual take an immutable reference #7254

Open
@alice-i-cecile

Description

@alice-i-cecile
          > Is there a way we can make `SystemStare::get_manual` take an immutable reference to self? Similar to `QueryState::get_manual`.

At first glance, this seems very difficult to generalize. We'd have to change SystemParam::get_param to take an immutable refence to the state, which would break params that need to modify their state such as Commands or Local or EventReader.

One way of doing this would be to add a new trait for SystemParams that do not mutably access their state in get_param, and then add SystemState::get_readonly which is constrained to using this trait. This would allow most SystemParams to be used with a read-only SystemState, while excluding the param types that don't make sense. I am not exactly sure what this would look like, though.

Originally posted by @JoJoJet in #7084 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ECSEntities, components, systems, and eventsC-PerformanceA change motivated by improving speed, memory usage or compile timesC-UsabilityA targeted quality-of-life change that makes Bevy easier to useD-ComplexQuite challenging from either a design or technical perspective. Ask for help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions