Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Merged by Bors] - Add FromWorld bound to T in Local<T> #5481

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions crates/bevy_ecs/src/system/system_param.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,12 +640,12 @@ impl<'w, 's> SystemParamFetch<'w, 's> for WorldState {
/// // .add_system(reset_to_system(my_config))
/// # assert_is_system(reset_to_system(Config(10)));
/// ```
pub struct Local<'a, T: Resource>(&'a mut T);
pub struct Local<'a, T: Resource + FromWorld>(&'a mut T);

// SAFETY: Local only accesses internal state
unsafe impl<T: Resource> ReadOnlySystemParamFetch for LocalState<T> {}

impl<'a, T: Resource> Debug for Local<'a, T>
impl<'a, T: Resource + FromWorld> Debug for Local<'a, T>
where
T: Debug,
{
Expand All @@ -654,7 +654,7 @@ where
}
}

impl<'a, T: Resource> Deref for Local<'a, T> {
impl<'a, T: Resource + FromWorld> Deref for Local<'a, T> {
type Target = T;

#[inline]
Expand All @@ -663,7 +663,7 @@ impl<'a, T: Resource> Deref for Local<'a, T> {
}
}

impl<'a, T: Resource> DerefMut for Local<'a, T> {
impl<'a, T: Resource + FromWorld> DerefMut for Local<'a, T> {
#[inline]
fn deref_mut(&mut self) -> &mut Self::Target {
self.0
Expand Down