Skip to content

Commit

Permalink
Expose access to SubApps within App (#16952)
Browse files Browse the repository at this point in the history
# Objective
`SubApps` is visible within the documentation for `bevy_app`. However,
no way of accessing the `SubApps` field in `App` is currently available.

## Solution
Expose two new functions, `App::sub_apps()` and `App::sub_apps_mut()`,
which give immutable and mutable access to `SubApps` respectively.

The other solution is to hide `SubApps`, which I submitted as a PR at
<#16953>.

## Testing
Because of the simplicity of the changes, I only tested by compiling
`bevy_app` - which compiled successfully.

Note: `SubApps`, and its corresponding field on `App`, are not used
outside of `bevy_app` - which means that compiling the other crates is
not necessary.
  • Loading branch information
LikeLakers2 authored Dec 24, 2024
1 parent 4acb34e commit 4a681c3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1058,6 +1058,16 @@ impl App {
&mut self.sub_apps.main
}

/// Returns a reference to the [`SubApps`] collection.
pub fn sub_apps(&self) -> &SubApps {
&self.sub_apps
}

/// Returns a mutable reference to the [`SubApps`] collection.
pub fn sub_apps_mut(&mut self) -> &mut SubApps {
&mut self.sub_apps
}

/// Returns a reference to the [`SubApp`] with the given label.
///
/// # Panics
Expand Down

0 comments on commit 4a681c3

Please sign in to comment.