@@ -2,19 +2,35 @@ use super::SystemId;
2
2
use crate :: resource:: { Resource , Resources } ;
3
3
use bevy_hecs:: { Bundle , Component , DynamicBundle , Entity , EntityReserver , World } ;
4
4
use parking_lot:: Mutex ;
5
- use std:: { marker:: PhantomData , sync:: Arc } ;
5
+ use std:: { fmt , marker:: PhantomData , sync:: Arc } ;
6
6
7
7
/// A queued command to mutate the current [World] or [Resources]
8
8
pub enum Command {
9
9
WriteWorld ( Box < dyn WorldWriter > ) ,
10
10
WriteResources ( Box < dyn ResourcesWriter > ) ,
11
11
}
12
12
13
+ impl fmt:: Debug for Command {
14
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
15
+ match self {
16
+ Command :: WriteWorld ( x) => f
17
+ . debug_tuple ( "WriteWorld" )
18
+ . field ( & ( x. as_ref ( ) as * const dyn WorldWriter ) )
19
+ . finish ( ) ,
20
+ Command :: WriteResources ( x) => f
21
+ . debug_tuple ( "WriteResources" )
22
+ . field ( & ( x. as_ref ( ) as * const dyn ResourcesWriter ) )
23
+ . finish ( ) ,
24
+ }
25
+ }
26
+ }
27
+
13
28
/// A [World] mutation
14
29
pub trait WorldWriter : Send + Sync {
15
30
fn write ( self : Box < Self > , world : & mut World ) ;
16
31
}
17
32
33
+ #[ derive( Debug ) ]
18
34
pub ( crate ) struct Spawn < T >
19
35
where
20
36
T : DynamicBundle + Send + Sync + ' static ,
49
65
}
50
66
}
51
67
68
+ #[ derive( Debug ) ]
52
69
pub ( crate ) struct Despawn {
53
70
entity : Entity ,
54
71
}
76
93
}
77
94
}
78
95
96
+ #[ derive( Debug ) ]
79
97
pub ( crate ) struct InsertOne < T >
80
98
where
81
99
T : Component ,
93
111
}
94
112
}
95
113
114
+ #[ derive( Debug ) ]
96
115
pub ( crate ) struct RemoveOne < T >
97
116
where
98
117
T : Component ,
@@ -112,6 +131,7 @@ where
112
131
}
113
132
}
114
133
134
+ #[ derive( Debug ) ]
115
135
pub ( crate ) struct Remove < T >
116
136
where
117
137
T : Bundle + Send + Sync + ' static ,
@@ -143,6 +163,7 @@ impl<T: Resource> ResourcesWriter for InsertResource<T> {
143
163
}
144
164
}
145
165
166
+ #[ derive( Debug ) ]
146
167
pub ( crate ) struct InsertLocalResource < T : Resource > {
147
168
resource : T ,
148
169
system_id : SystemId ,
@@ -154,7 +175,7 @@ impl<T: Resource> ResourcesWriter for InsertLocalResource<T> {
154
175
}
155
176
}
156
177
157
- #[ derive( Default ) ]
178
+ #[ derive( Debug , Default ) ]
158
179
pub struct CommandsInternal {
159
180
pub commands : Vec < Command > ,
160
181
pub current_entity : Option < Entity > ,
@@ -212,7 +233,7 @@ impl CommandsInternal {
212
233
}
213
234
214
235
/// A queue of [Command]s to run on the current [World] and [Resources]
215
- #[ derive( Default , Clone ) ]
236
+ #[ derive( Debug , Default , Clone ) ]
216
237
pub struct Commands {
217
238
pub commands : Arc < Mutex < CommandsInternal > > ,
218
239
}
0 commit comments