@@ -11,25 +11,25 @@ use crate::{
1111use std:: any:: TypeId ;
1212
1313impl < ' a , T : Component > WorldQuery for EventWriter < ' a , T > {
14- type Fetch = EventWriterFetch < ' a , T > ;
14+ type Fetch = EventWriterFetch < T > ;
1515 type State = EventWriterState < T > ;
1616}
1717
18- struct EventWriterFetch < ' s , T > {
18+ struct EventWriterFetch < T > {
1919 /// EventWriter query parameters require write access to &mut Events<T>
2020 write_fetch : WriteFetch < Events < T > > ,
21- state : & ' s EventWriterState < T > ,
21+ storage_type : StorageType ,
2222}
2323
24- impl < ' a , T : Component > Fetch < ' a > for EventWriterFetch < ' a , T > {
24+ impl < ' a , T : Component > Fetch < ' a > for EventWriterFetch < T > {
2525 /// EventWriter queries return an EventWriter<T> in each item
2626 type Item = EventWriter < ' a , T > ;
2727 /// This is the corresponding S: FetchState type
2828 type State = EventWriterState < T > ;
2929
3030 /// Checks the storage type of the corresponding Events<T> component
3131 fn is_dense ( & self ) -> bool {
32- match self . state . event_storage_type {
32+ match self . storage_type {
3333 StorageType :: SparseSet => false ,
3434 StorageType :: Table => true ,
3535 }
@@ -48,7 +48,11 @@ impl<'a, T: Component> Fetch<'a> for EventWriterFetch<'a, T> {
4848 last_change_tick,
4949 change_tick,
5050 ) ,
51- state,
51+ storage_type : world
52+ . components
53+ . get_info ( world. components . get_id ( TypeId :: of :: < Events < T > > ( ) ) . unwrap ( ) )
54+ . unwrap ( )
55+ . storage_type ( ) ,
5256 }
5357 }
5458
0 commit comments