@@ -123,23 +123,20 @@ pub struct AccessData {
123123}
124124
125125impl AccessData {
126- fn try_new ( value : & bevy_ecs:: query:: Access , trace : & mut ComponentTrace ) -> Option < Self > {
127- // TODO: `try_reads_and_writes` returns error if `read_and_writes_inverted=true`,
128- // thus `AccessData` always has `read_and_writes_inverted=false`
129- // Consider making `try_reads_and_writes()` return an enum of Normal or Except
130- // Then can remove `read_and_writes_inverted()`.
131- // Similarly for `try_writes()` and `writes_inverted` and `writes_inverted()`.
126+ fn new ( value : & bevy_ecs:: query:: Access , trace : & mut ComponentTrace ) -> Self {
127+ let read_and_writes = value. reads_and_writes ( ) ;
128+ let writes = value. writes ( ) ;
132129
133- let read_and_writes = value . try_reads_and_writes ( ) . ok ( ) ? ;
134- let writes = value . try_writes ( ) . ok ( ) ? ;
130+ let read_and_writes_inverted = read_and_writes . inverted ( ) ;
131+ let writes_inverted = writes . inverted ( ) ;
135132
136- Some ( Self {
133+ Self {
137134 read_and_writes : trace. get_indexes ( read_and_writes. iter ( ) ) ,
138135 writes : trace. get_indexes ( writes. iter ( ) ) ,
139- read_and_writes_inverted : value . read_and_writes_inverted ( ) ,
140- writes_inverted : value . writes_inverted ( ) ,
136+ read_and_writes_inverted,
137+ writes_inverted,
141138 archetypal : trace. get_indexes ( value. archetypal ( ) . iter ( ) ) ,
142- } )
139+ }
143140 }
144141}
145142
@@ -173,13 +170,10 @@ pub struct FilteredAccessData {
173170}
174171
175172impl FilteredAccessData {
176- fn try_new (
177- value : & bevy_ecs:: query:: FilteredAccess ,
178- trace : & mut ComponentTrace ,
179- ) -> Option < Self > {
180- let access = AccessData :: try_new ( value. access ( ) , trace) ?;
173+ fn new ( value : & bevy_ecs:: query:: FilteredAccess , trace : & mut ComponentTrace ) -> Self {
174+ let access = AccessData :: new ( value. access ( ) , trace) ;
181175
182- Some ( Self {
176+ Self {
183177 access,
184178 required : trace. get_indexes ( value. required ( ) . iter ( ) ) ,
185179 filter_sets : value
@@ -190,7 +184,7 @@ impl FilteredAccessData {
190184 without : trace. get_indexes ( f. without ( ) . iter ( ) ) ,
191185 } )
192186 . collect ( ) ,
193- } )
187+ }
194188 }
195189}
196190
@@ -334,14 +328,10 @@ impl ScheduleData {
334328 == core:: any:: TypeId :: of :: < ApplyDeferred > ( ) ,
335329 exclusive : flags. contains ( SystemStateFlags :: EXCLUSIVE ) ,
336330 deferred : flags. contains ( SystemStateFlags :: DEFERRED ) ,
337- combined_access : AccessData :: try_new ( combined_access, & mut component_trace)
338- . unwrap_or_default ( ) ,
331+ combined_access : AccessData :: new ( combined_access, & mut component_trace) ,
339332 filtered_accesses : filtered_accesses
340333 . iter ( )
341- . map ( |fa| {
342- FilteredAccessData :: try_new ( fa, & mut component_trace)
343- . unwrap_or_default ( )
344- } )
334+ . map ( |fa| FilteredAccessData :: new ( fa, & mut component_trace) )
345335 . collect ( ) ,
346336 }
347337 } )
0 commit comments