@@ -32,7 +32,7 @@ use super::{Deferred, Resource, SystemBuffer, SystemMeta};
3232/// struct AddToCounter(u64);
3333///
3434/// impl Command for AddToCounter {
35- /// fn write (self, world: &mut World) {
35+ /// fn apply (self, world: &mut World) {
3636/// let mut counter = world.get_resource_or_insert_with(Counter::default);
3737/// counter.0 += self.0;
3838/// }
@@ -43,8 +43,8 @@ use super::{Deferred, Resource, SystemBuffer, SystemMeta};
4343/// }
4444/// ```
4545pub trait Command : Send + ' static {
46- /// Executes this command.
47- fn write ( self , world : & mut World ) ;
46+ /// Applies this command.
47+ fn apply ( self , world : & mut World ) ;
4848}
4949
5050/// A [`Command`] queue to perform impactful changes to the [`World`].
@@ -522,7 +522,7 @@ impl<'w, 's> Commands<'w, 's> {
522522 /// struct AddToCounter(u64);
523523 ///
524524 /// impl Command for AddToCounter {
525- /// fn write (self, world: &mut World) {
525+ /// fn apply (self, world: &mut World) {
526526 /// let mut counter = world.get_resource_or_insert_with(Counter::default);
527527 /// counter.0 += self.0;
528528 /// }
@@ -569,7 +569,7 @@ impl<'w, 's> Commands<'w, 's> {
569569/// struct CountName;
570570///
571571/// impl EntityCommand for CountName {
572- /// fn write (self, id: Entity, world: &mut World) {
572+ /// fn apply (self, id: Entity, world: &mut World) {
573573/// // Get the current value of the counter, and increment it for next time.
574574/// let mut counter = world.resource_mut::<Counter>();
575575/// let i = counter.0;
@@ -605,7 +605,7 @@ impl<'w, 's> Commands<'w, 's> {
605605/// ```
606606pub trait EntityCommand : Send + ' static {
607607 /// Executes this command for the given [`Entity`].
608- fn write ( self , id : Entity , world : & mut World ) ;
608+ fn apply ( self , id : Entity , world : & mut World ) ;
609609 /// Returns a [`Command`] which executes this [`EntityCommand`] for the given [`Entity`].
610610 fn with_entity ( self , id : Entity ) -> WithEntity < Self >
611611 where
@@ -623,8 +623,8 @@ pub struct WithEntity<C: EntityCommand> {
623623
624624impl < C : EntityCommand > Command for WithEntity < C > {
625625 #[ inline]
626- fn write ( self , world : & mut World ) {
627- self . cmd . write ( self . id , world) ;
626+ fn apply ( self , world : & mut World ) {
627+ self . cmd . apply ( self . id , world) ;
628628 }
629629}
630630
@@ -829,7 +829,7 @@ impl<F> Command for F
829829where
830830 F : FnOnce ( & mut World ) + Send + ' static ,
831831{
832- fn write ( self , world : & mut World ) {
832+ fn apply ( self , world : & mut World ) {
833833 self ( world) ;
834834 }
835835}
@@ -838,7 +838,7 @@ impl<F> EntityCommand for F
838838where
839839 F : FnOnce ( Entity , & mut World ) + Send + ' static ,
840840{
841- fn write ( self , id : Entity , world : & mut World ) {
841+ fn apply ( self , id : Entity , world : & mut World ) {
842842 self ( id, world) ;
843843 }
844844}
@@ -854,7 +854,7 @@ impl<T> Command for Spawn<T>
854854where
855855 T : Bundle ,
856856{
857- fn write ( self , world : & mut World ) {
857+ fn apply ( self , world : & mut World ) {
858858 world. spawn ( self . bundle ) ;
859859 }
860860}
@@ -876,7 +876,7 @@ where
876876 I : IntoIterator + Send + Sync + ' static ,
877877 I :: Item : Bundle ,
878878{
879- fn write ( self , world : & mut World ) {
879+ fn apply ( self , world : & mut World ) {
880880 world. spawn_batch ( self . bundles_iter ) ;
881881 }
882882}
@@ -901,7 +901,7 @@ where
901901 B : Bundle ,
902902 I :: IntoIter : Iterator < Item = ( Entity , B ) > ,
903903{
904- fn write ( self , world : & mut World ) {
904+ fn apply ( self , world : & mut World ) {
905905 if let Err ( invalid_entities) = world. insert_or_spawn_batch ( self . bundles_iter ) {
906906 error ! (
907907 "Failed to 'insert or spawn' bundle of type {} into the following invalid entities: {:?}" ,
@@ -921,7 +921,7 @@ pub struct Despawn {
921921}
922922
923923impl Command for Despawn {
924- fn write ( self , world : & mut World ) {
924+ fn apply ( self , world : & mut World ) {
925925 world. despawn ( self . entity ) ;
926926 }
927927}
@@ -938,7 +938,7 @@ impl<T> Command for Insert<T>
938938where
939939 T : Bundle + ' static ,
940940{
941- fn write ( self , world : & mut World ) {
941+ fn apply ( self , world : & mut World ) {
942942 if let Some ( mut entity) = world. get_entity_mut ( self . entity ) {
943943 entity. insert ( self . bundle ) ;
944944 } else {
@@ -961,7 +961,7 @@ impl<T> Command for Remove<T>
961961where
962962 T : Bundle ,
963963{
964- fn write ( self , world : & mut World ) {
964+ fn apply ( self , world : & mut World ) {
965965 if let Some ( mut entity_mut) = world. get_entity_mut ( self . entity ) {
966966 entity_mut. remove :: < T > ( ) ;
967967 }
@@ -985,7 +985,7 @@ pub struct InitResource<R: Resource + FromWorld> {
985985}
986986
987987impl < R : Resource + FromWorld > Command for InitResource < R > {
988- fn write ( self , world : & mut World ) {
988+ fn apply ( self , world : & mut World ) {
989989 world. init_resource :: < R > ( ) ;
990990 }
991991}
@@ -1006,7 +1006,7 @@ pub struct InsertResource<R: Resource> {
10061006}
10071007
10081008impl < R : Resource > Command for InsertResource < R > {
1009- fn write ( self , world : & mut World ) {
1009+ fn apply ( self , world : & mut World ) {
10101010 world. insert_resource ( self . resource ) ;
10111011 }
10121012}
@@ -1017,7 +1017,7 @@ pub struct RemoveResource<R: Resource> {
10171017}
10181018
10191019impl < R : Resource > Command for RemoveResource < R > {
1020- fn write ( self , world : & mut World ) {
1020+ fn apply ( self , world : & mut World ) {
10211021 world. remove_resource :: < R > ( ) ;
10221022 }
10231023}
@@ -1037,7 +1037,7 @@ pub struct LogComponents {
10371037}
10381038
10391039impl Command for LogComponents {
1040- fn write ( self , world : & mut World ) {
1040+ fn apply ( self , world : & mut World ) {
10411041 let debug_infos: Vec < _ > = world
10421042 . inspect_entity ( self . entity )
10431043 . into_iter ( )
0 commit comments