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

Improve encapsulation for commands and add docs #8725

Merged
merged 4 commits into from
May 31, 2023
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
hide PhantomData fields
  • Loading branch information
JoJoJet committed May 31, 2023
commit baabefca3b47f77645205a246e5ce99365a27e36
12 changes: 6 additions & 6 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -931,7 +931,7 @@ where
#[derive(Debug)]
pub struct Remove<T> {
pub entity: Entity,
pub phantom: PhantomData<T>,
_marker: PhantomData<T>,
}

impl<T> Command for Remove<T>
Expand All @@ -950,13 +950,13 @@ impl<T> Remove<T> {
pub const fn new(entity: Entity) -> Self {
Self {
entity,
phantom: PhantomData::<T>,
_marker: PhantomData::<T>,
}
}
}

pub struct InitResource<R: Resource + FromWorld> {
_phantom: PhantomData<R>,
_marker: PhantomData<R>,
}

impl<R: Resource + FromWorld> Command for InitResource<R> {
Expand All @@ -969,7 +969,7 @@ impl<R: Resource + FromWorld> InitResource<R> {
/// Creates a [`Command`] which will insert a default created [`Resource`] into the [`World`]
pub const fn new() -> Self {
Self {
_phantom: PhantomData::<R>,
_marker: PhantomData::<R>,
}
}
}
Expand All @@ -985,7 +985,7 @@ impl<R: Resource> Command for InsertResource<R> {
}

pub struct RemoveResource<R: Resource> {
pub phantom: PhantomData<R>,
_marker: PhantomData<R>,
}

impl<R: Resource> Command for RemoveResource<R> {
Expand All @@ -998,7 +998,7 @@ impl<R: Resource> RemoveResource<R> {
/// Creates a [`Command`] which will remove a [`Resource`] from the [`World`]
pub const fn new() -> Self {
Self {
phantom: PhantomData::<R>,
_marker: PhantomData::<R>,
}
}
}
Expand Down