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] - Remove .system() #4499

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/system/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -284,10 +284,10 @@ impl<'w, 's> Commands<'w, 's> {
/// # high_score: u32,
/// # }
/// #
/// # fn system(mut commands: Commands) {
/// # fn initialise_scoreboard(mut commands: Commands) {
/// commands.init_resource::<Scoreboard>();
/// # }
/// # system.system();
/// # bevy_ecs::system::assert_is_system(initialise_scoreboard);
/// ```
pub fn init_resource<R: Resource + FromWorld>(&mut self) {
self.queue.push(InitResource::<R> {
Expand Down
24 changes: 2 additions & 22 deletions crates/bevy_ecs/src/system/function_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,34 +249,14 @@ impl<Param: SystemParam> FromWorld for SystemState<Param> {
///
/// fn my_system_function(an_usize_resource: Res<usize>) {}
///
/// let system = IntoSystem::system(my_system_function);
/// let system = IntoSystem::into_system(my_system_function);
/// ```
// This trait has to be generic because we have potentially overlapping impls, in particular
// because Rust thinks a type could impl multiple different `FnMut` combinations
// even though none can currently
pub trait IntoSystem<In, Out, Params>: Sized {
type System: System<In = In, Out = Out>;
/// Turns this value into its corresponding [`System`].
///
/// Use of this method was formerly required whenever adding a `system` to an `App`.
/// or other cases where a system is required.
/// However, since [#2398](https://github.com/bevyengine/bevy/pull/2398),
/// this is no longer required.
///
/// In future, this method will be removed.
///
/// One use of this method is to assert that a given function is a valid system.
/// For this case, use [`bevy_ecs::system::assert_is_system`] instead.
///
/// [`bevy_ecs::system::assert_is_system`]: [`crate::system::assert_is_system`]:
#[deprecated(
since = "0.7.0",
note = "`.system()` is no longer needed, as methods which accept systems will convert functions into a system automatically"
)]
fn system(self) -> Self::System {
IntoSystem::into_system(self)
}
/// Turns this value into its corresponding [`System`].
fn into_system(this: Self) -> Self::System;
}

Expand Down Expand Up @@ -322,7 +302,7 @@ pub struct InputMarker;

/// The [`System`] counter part of an ordinary function.
///
/// You get this by calling [`IntoSystem::system`] on a function that only accepts
/// You get this by calling [`IntoSystem::into_system`] on a function that only accepts
/// [`SystemParam`]s. The output of the system becomes the functions return type, while the input
/// becomes the functions [`In`] tagged parameter or `()` if no such parameter exists.
pub struct FunctionSystem<In, Out, Param, Marker, F>
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/system/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ where
/// println!("Bam!")
/// }
/// }
/// # targeting_system.system();
/// # bevy_ecs::system::assert_is_system(targeting_system);
/// ```
#[inline]
pub fn contains(&self, entity: Entity) -> bool {
Expand Down