bevyengine / bevyengine/bevy

Expose `SystemMeta` fields

Open
#5,497 10 comments 2 reactions 0 assignees View on GitHub
A-ECS C-Usability D-Complex S-Adopt-Me
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

`bevy_ecs`' internal implementation of the default `SystemParam`s use `SystemMeta` to initialize their states. Yet, only the `is_send()` field accessor is public to end-users and all other fields are `pub(crate)`.

```rust
/// The metadata of a [`System`].
#[derive(Clone)]
pub struct SystemMeta {
pub(crate) name: Cow<'static, str>,
pub(crate) component_access_set: FilteredAccessSet,
pub(crate) archetype_component_access: Access,
// NOTE: this must be kept private. making a SystemMeta non-send is irreversible to prevent
// SystemParams from overriding each other
is_send: bool,
pub(crate) last_change_tick: u32,
}
```

Given that it's possible to directly implement `SystemParam` (and `SystemParamFetch`) for user-defined types in an `unsafe impl`, these fields should be exposed to advanced users.

## What solution would you like?

Add unsafe mutable and safe immutable accessors for `component_access_set` and `archetype_component_access`, and immutable accessors for `name` and `last_change_tick`.

Contributor guide

Open the contributing guide

Research direction

Locate SystemMeta in bevy_ecs and review the existing public is_send() accessor alongside the SystemParam and SystemParamFetch implementations. Verify that the requested accessors cover name, last_change_tick, component_access_set, and archetype_component_access with the stated mutability and safety expectations, then confirm the public API compiles.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.