• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mlange-42 / ark / 13597253646

28 Feb 2025 10:03PM CUT coverage: 96.9% (-0.09%) from 96.988%
13597253646

Pull #82

github

web-flow
Merge 52c6f9ea6 into 5263582b2
Pull Request #82: Unsafe filter and query

234 of 242 new or added lines in 3 files covered. (96.69%)

17 existing lines in 1 file now uncovered.

3626 of 3742 relevant lines covered (96.9%)

50664.41 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

98.14
/ecs/filter_gen.go
1
package ecs
2

3
// Code generated by go generate; DO NOT EDIT.
4

5
// Filter0 is a filter for 0 components.
6
type Filter0 struct {
7
        world     *World
8
        ids       []ID
9
        filter    Filter
10
        relations []RelationID
11
}
12

13
// NewFilter0 creates a new [Filter0].
14
//
15
// Use [Filter0.Query] to obtain a [Query0].
16
func NewFilter0(world *World) *Filter0 {
7✔
17
        ids := []ID{}
7✔
18

7✔
19
        return &Filter0{
7✔
20
                world:  world,
7✔
21
                ids:    ids,
7✔
22
                filter: NewFilter(ids...),
7✔
23
        }
7✔
24
}
7✔
25

26
// With specifies additional components to filter for.
27
func (f *Filter0) With(comps ...Comp) *Filter0 {
1✔
28
        for _, c := range comps {
2✔
29
                id := f.world.componentID(c.tp)
1✔
30
                f.filter.mask.Set(id, true)
1✔
31
        }
1✔
32
        return f
1✔
33
}
34

35
// Without specifies components to exclude.
36
func (f *Filter0) Without(comps ...Comp) *Filter0 {
2✔
37
        for _, c := range comps {
4✔
38
                id := f.world.componentID(c.tp)
2✔
39
                f.filter.without.Set(id, true)
2✔
40
                f.filter.hasWithout = true
2✔
41
        }
2✔
42
        return f
2✔
43
}
44

45
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
46
// and no other components are allowed.
47
func (f *Filter0) Exclusive() *Filter0 {
1✔
48
        f.filter = f.filter.Exclusive()
1✔
49
        return f
1✔
50
}
1✔
51

52
// Query creates a [Query0] from this filter.
53
// This must be used each time before iterating a query.
54
func (f *Filter0) Query(rel ...RelationIndex) Query0 {
8✔
55
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
8✔
56
        return newQuery0(f.world, f.filter, f.relations)
8✔
57
}
8✔
58

59
// Batch creates a [Batch] from this filter.
NEW
60
func (f *Filter0) Batch(rel ...RelationIndex) Batch {
×
NEW
61
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
×
62
        return Batch{
×
NEW
63
                filter:    f.filter,
×
NEW
64
                relations: f.relations,
×
65
        }
×
66
}
×
67

68
// Filter1 is a filter for 1 components.
69
type Filter1[A any] struct {
70
        world     *World
71
        ids       []ID
72
        filter    Filter
73
        relations []RelationID
74
}
75

76
// NewFilter1 creates a new [Filter1].
77
//
78
// Use [Filter1.Query] to obtain a [Query1].
79
func NewFilter1[A any](world *World) *Filter1[A] {
1,009✔
80
        ids := []ID{
1,009✔
81
                ComponentID[A](world),
1,009✔
82
        }
1,009✔
83

1,009✔
84
        return &Filter1[A]{
1,009✔
85
                world:  world,
1,009✔
86
                ids:    ids,
1,009✔
87
                filter: NewFilter(ids...),
1,009✔
88
        }
1,009✔
89
}
1,009✔
90

91
// With specifies additional components to filter for.
92
func (f *Filter1[A]) With(comps ...Comp) *Filter1[A] {
1✔
93
        for _, c := range comps {
2✔
94
                id := f.world.componentID(c.tp)
1✔
95
                f.filter.mask.Set(id, true)
1✔
96
        }
1✔
97
        return f
1✔
98
}
99

100
// Without specifies components to exclude.
101
func (f *Filter1[A]) Without(comps ...Comp) *Filter1[A] {
1✔
102
        for _, c := range comps {
2✔
103
                id := f.world.componentID(c.tp)
1✔
104
                f.filter.without.Set(id, true)
1✔
105
                f.filter.hasWithout = true
1✔
106
        }
1✔
107
        return f
1✔
108
}
109

110
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
111
// and no other components are allowed.
112
func (f *Filter1[A]) Exclusive() *Filter1[A] {
1✔
113
        f.filter = f.filter.Exclusive()
1✔
114
        return f
1✔
115
}
1✔
116

117
// Query creates a [Query1] from this filter.
118
// This must be used each time before iterating a query.
119
func (f *Filter1[A]) Query(rel ...RelationIndex) Query1[A] {
1,009✔
120
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1,009✔
121
        return newQuery1[A](f.world, f.filter, f.ids, f.relations)
1,009✔
122
}
1,009✔
123

124
// Batch creates a [Batch] from this filter.
125
func (f *Filter1[A]) Batch(rel ...RelationIndex) Batch {
1✔
126
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
127
        return Batch{
1✔
128
                filter:    f.filter,
1✔
129
                relations: f.relations,
1✔
130
        }
1✔
131
}
1✔
132

133
// Filter2 is a filter for 2 components.
134
type Filter2[A any, B any] struct {
135
        world     *World
136
        ids       []ID
137
        filter    Filter
138
        relations []RelationID
139
}
140

141
// NewFilter2 creates a new [Filter2].
142
//
143
// Use [Filter2.Query] to obtain a [Query2].
144
func NewFilter2[A any, B any](world *World) *Filter2[A, B] {
10✔
145
        ids := []ID{
10✔
146
                ComponentID[A](world),
10✔
147
                ComponentID[B](world),
10✔
148
        }
10✔
149

10✔
150
        return &Filter2[A, B]{
10✔
151
                world:  world,
10✔
152
                ids:    ids,
10✔
153
                filter: NewFilter(ids...),
10✔
154
        }
10✔
155
}
10✔
156

157
// With specifies additional components to filter for.
158
func (f *Filter2[A, B]) With(comps ...Comp) *Filter2[A, B] {
1✔
159
        for _, c := range comps {
2✔
160
                id := f.world.componentID(c.tp)
1✔
161
                f.filter.mask.Set(id, true)
1✔
162
        }
1✔
163
        return f
1✔
164
}
165

166
// Without specifies components to exclude.
167
func (f *Filter2[A, B]) Without(comps ...Comp) *Filter2[A, B] {
1✔
168
        for _, c := range comps {
2✔
169
                id := f.world.componentID(c.tp)
1✔
170
                f.filter.without.Set(id, true)
1✔
171
                f.filter.hasWithout = true
1✔
172
        }
1✔
173
        return f
1✔
174
}
175

176
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
177
// and no other components are allowed.
178
func (f *Filter2[A, B]) Exclusive() *Filter2[A, B] {
1✔
179
        f.filter = f.filter.Exclusive()
1✔
180
        return f
1✔
181
}
1✔
182

183
// Query creates a [Query2] from this filter.
184
// This must be used each time before iterating a query.
185
func (f *Filter2[A, B]) Query(rel ...RelationIndex) Query2[A, B] {
10✔
186
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
10✔
187
        return newQuery2[A, B](f.world, f.filter, f.ids, f.relations)
10✔
188
}
10✔
189

190
// Batch creates a [Batch] from this filter.
191
func (f *Filter2[A, B]) Batch(rel ...RelationIndex) Batch {
1✔
192
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
193
        return Batch{
1✔
194
                filter:    f.filter,
1✔
195
                relations: f.relations,
1✔
196
        }
1✔
197
}
1✔
198

199
// Filter3 is a filter for 3 components.
200
type Filter3[A any, B any, C any] struct {
201
        world     *World
202
        ids       []ID
203
        filter    Filter
204
        relations []RelationID
205
}
206

207
// NewFilter3 creates a new [Filter3].
208
//
209
// Use [Filter3.Query] to obtain a [Query3].
210
func NewFilter3[A any, B any, C any](world *World) *Filter3[A, B, C] {
10✔
211
        ids := []ID{
10✔
212
                ComponentID[A](world),
10✔
213
                ComponentID[B](world),
10✔
214
                ComponentID[C](world),
10✔
215
        }
10✔
216

10✔
217
        return &Filter3[A, B, C]{
10✔
218
                world:  world,
10✔
219
                ids:    ids,
10✔
220
                filter: NewFilter(ids...),
10✔
221
        }
10✔
222
}
10✔
223

224
// With specifies additional components to filter for.
225
func (f *Filter3[A, B, C]) With(comps ...Comp) *Filter3[A, B, C] {
1✔
226
        for _, c := range comps {
2✔
227
                id := f.world.componentID(c.tp)
1✔
228
                f.filter.mask.Set(id, true)
1✔
229
        }
1✔
230
        return f
1✔
231
}
232

233
// Without specifies components to exclude.
234
func (f *Filter3[A, B, C]) Without(comps ...Comp) *Filter3[A, B, C] {
1✔
235
        for _, c := range comps {
2✔
236
                id := f.world.componentID(c.tp)
1✔
237
                f.filter.without.Set(id, true)
1✔
238
                f.filter.hasWithout = true
1✔
239
        }
1✔
240
        return f
1✔
241
}
242

243
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
244
// and no other components are allowed.
245
func (f *Filter3[A, B, C]) Exclusive() *Filter3[A, B, C] {
1✔
246
        f.filter = f.filter.Exclusive()
1✔
247
        return f
1✔
248
}
1✔
249

250
// Query creates a [Query3] from this filter.
251
// This must be used each time before iterating a query.
252
func (f *Filter3[A, B, C]) Query(rel ...RelationIndex) Query3[A, B, C] {
12✔
253
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
12✔
254
        return newQuery3[A, B, C](f.world, f.filter, f.ids, f.relations)
12✔
255
}
12✔
256

257
// Batch creates a [Batch] from this filter.
258
func (f *Filter3[A, B, C]) Batch(rel ...RelationIndex) Batch {
1✔
259
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
260
        return Batch{
1✔
261
                filter:    f.filter,
1✔
262
                relations: f.relations,
1✔
263
        }
1✔
264
}
1✔
265

266
// Filter4 is a filter for 4 components.
267
type Filter4[A any, B any, C any, D any] struct {
268
        world     *World
269
        ids       []ID
270
        filter    Filter
271
        relations []RelationID
272
}
273

274
// NewFilter4 creates a new [Filter4].
275
//
276
// Use [Filter4.Query] to obtain a [Query4].
277
func NewFilter4[A any, B any, C any, D any](world *World) *Filter4[A, B, C, D] {
9✔
278
        ids := []ID{
9✔
279
                ComponentID[A](world),
9✔
280
                ComponentID[B](world),
9✔
281
                ComponentID[C](world),
9✔
282
                ComponentID[D](world),
9✔
283
        }
9✔
284

9✔
285
        return &Filter4[A, B, C, D]{
9✔
286
                world:  world,
9✔
287
                ids:    ids,
9✔
288
                filter: NewFilter(ids...),
9✔
289
        }
9✔
290
}
9✔
291

292
// With specifies additional components to filter for.
293
func (f *Filter4[A, B, C, D]) With(comps ...Comp) *Filter4[A, B, C, D] {
1✔
294
        for _, c := range comps {
2✔
295
                id := f.world.componentID(c.tp)
1✔
296
                f.filter.mask.Set(id, true)
1✔
297
        }
1✔
298
        return f
1✔
299
}
300

301
// Without specifies components to exclude.
302
func (f *Filter4[A, B, C, D]) Without(comps ...Comp) *Filter4[A, B, C, D] {
1✔
303
        for _, c := range comps {
2✔
304
                id := f.world.componentID(c.tp)
1✔
305
                f.filter.without.Set(id, true)
1✔
306
                f.filter.hasWithout = true
1✔
307
        }
1✔
308
        return f
1✔
309
}
310

311
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
312
// and no other components are allowed.
313
func (f *Filter4[A, B, C, D]) Exclusive() *Filter4[A, B, C, D] {
1✔
314
        f.filter = f.filter.Exclusive()
1✔
315
        return f
1✔
316
}
1✔
317

318
// Query creates a [Query4] from this filter.
319
// This must be used each time before iterating a query.
320
func (f *Filter4[A, B, C, D]) Query(rel ...RelationIndex) Query4[A, B, C, D] {
9✔
321
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
9✔
322
        return newQuery4[A, B, C, D](f.world, f.filter, f.ids, f.relations)
9✔
323
}
9✔
324

325
// Batch creates a [Batch] from this filter.
326
func (f *Filter4[A, B, C, D]) Batch(rel ...RelationIndex) Batch {
1✔
327
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
328
        return Batch{
1✔
329
                filter:    f.filter,
1✔
330
                relations: f.relations,
1✔
331
        }
1✔
332
}
1✔
333

334
// Filter5 is a filter for 5 components.
335
type Filter5[A any, B any, C any, D any, E any] struct {
336
        world     *World
337
        ids       []ID
338
        filter    Filter
339
        relations []RelationID
340
}
341

342
// NewFilter5 creates a new [Filter5].
343
//
344
// Use [Filter5.Query] to obtain a [Query5].
345
func NewFilter5[A any, B any, C any, D any, E any](world *World) *Filter5[A, B, C, D, E] {
9✔
346
        ids := []ID{
9✔
347
                ComponentID[A](world),
9✔
348
                ComponentID[B](world),
9✔
349
                ComponentID[C](world),
9✔
350
                ComponentID[D](world),
9✔
351
                ComponentID[E](world),
9✔
352
        }
9✔
353

9✔
354
        return &Filter5[A, B, C, D, E]{
9✔
355
                world:  world,
9✔
356
                ids:    ids,
9✔
357
                filter: NewFilter(ids...),
9✔
358
        }
9✔
359
}
9✔
360

361
// With specifies additional components to filter for.
362
func (f *Filter5[A, B, C, D, E]) With(comps ...Comp) *Filter5[A, B, C, D, E] {
1✔
363
        for _, c := range comps {
2✔
364
                id := f.world.componentID(c.tp)
1✔
365
                f.filter.mask.Set(id, true)
1✔
366
        }
1✔
367
        return f
1✔
368
}
369

370
// Without specifies components to exclude.
371
func (f *Filter5[A, B, C, D, E]) Without(comps ...Comp) *Filter5[A, B, C, D, E] {
1✔
372
        for _, c := range comps {
2✔
373
                id := f.world.componentID(c.tp)
1✔
374
                f.filter.without.Set(id, true)
1✔
375
                f.filter.hasWithout = true
1✔
376
        }
1✔
377
        return f
1✔
378
}
379

380
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
381
// and no other components are allowed.
382
func (f *Filter5[A, B, C, D, E]) Exclusive() *Filter5[A, B, C, D, E] {
1✔
383
        f.filter = f.filter.Exclusive()
1✔
384
        return f
1✔
385
}
1✔
386

387
// Query creates a [Query5] from this filter.
388
// This must be used each time before iterating a query.
389
func (f *Filter5[A, B, C, D, E]) Query(rel ...RelationIndex) Query5[A, B, C, D, E] {
9✔
390
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
9✔
391
        return newQuery5[A, B, C, D, E](f.world, f.filter, f.ids, f.relations)
9✔
392
}
9✔
393

394
// Batch creates a [Batch] from this filter.
395
func (f *Filter5[A, B, C, D, E]) Batch(rel ...RelationIndex) Batch {
1✔
396
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
397
        return Batch{
1✔
398
                filter:    f.filter,
1✔
399
                relations: f.relations,
1✔
400
        }
1✔
401
}
1✔
402

403
// Filter6 is a filter for 6 components.
404
type Filter6[A any, B any, C any, D any, E any, F any] struct {
405
        world     *World
406
        ids       []ID
407
        filter    Filter
408
        relations []RelationID
409
}
410

411
// NewFilter6 creates a new [Filter6].
412
//
413
// Use [Filter6.Query] to obtain a [Query6].
414
func NewFilter6[A any, B any, C any, D any, E any, F any](world *World) *Filter6[A, B, C, D, E, F] {
9✔
415
        ids := []ID{
9✔
416
                ComponentID[A](world),
9✔
417
                ComponentID[B](world),
9✔
418
                ComponentID[C](world),
9✔
419
                ComponentID[D](world),
9✔
420
                ComponentID[E](world),
9✔
421
                ComponentID[F](world),
9✔
422
        }
9✔
423

9✔
424
        return &Filter6[A, B, C, D, E, F]{
9✔
425
                world:  world,
9✔
426
                ids:    ids,
9✔
427
                filter: NewFilter(ids...),
9✔
428
        }
9✔
429
}
9✔
430

431
// With specifies additional components to filter for.
432
func (f *Filter6[A, B, C, D, E, F]) With(comps ...Comp) *Filter6[A, B, C, D, E, F] {
1✔
433
        for _, c := range comps {
2✔
434
                id := f.world.componentID(c.tp)
1✔
435
                f.filter.mask.Set(id, true)
1✔
436
        }
1✔
437
        return f
1✔
438
}
439

440
// Without specifies components to exclude.
441
func (f *Filter6[A, B, C, D, E, F]) Without(comps ...Comp) *Filter6[A, B, C, D, E, F] {
1✔
442
        for _, c := range comps {
2✔
443
                id := f.world.componentID(c.tp)
1✔
444
                f.filter.without.Set(id, true)
1✔
445
                f.filter.hasWithout = true
1✔
446
        }
1✔
447
        return f
1✔
448
}
449

450
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
451
// and no other components are allowed.
452
func (f *Filter6[A, B, C, D, E, F]) Exclusive() *Filter6[A, B, C, D, E, F] {
1✔
453
        f.filter = f.filter.Exclusive()
1✔
454
        return f
1✔
455
}
1✔
456

457
// Query creates a [Query6] from this filter.
458
// This must be used each time before iterating a query.
459
func (f *Filter6[A, B, C, D, E, F]) Query(rel ...RelationIndex) Query6[A, B, C, D, E, F] {
9✔
460
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
9✔
461
        return newQuery6[A, B, C, D, E, F](f.world, f.filter, f.ids, f.relations)
9✔
462
}
9✔
463

464
// Batch creates a [Batch] from this filter.
465
func (f *Filter6[A, B, C, D, E, F]) Batch(rel ...RelationIndex) Batch {
1✔
466
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
467
        return Batch{
1✔
468
                filter:    f.filter,
1✔
469
                relations: f.relations,
1✔
470
        }
1✔
471
}
1✔
472

473
// Filter7 is a filter for 7 components.
474
type Filter7[A any, B any, C any, D any, E any, F any, G any] struct {
475
        world     *World
476
        ids       []ID
477
        filter    Filter
478
        relations []RelationID
479
}
480

481
// NewFilter7 creates a new [Filter7].
482
//
483
// Use [Filter7.Query] to obtain a [Query7].
484
func NewFilter7[A any, B any, C any, D any, E any, F any, G any](world *World) *Filter7[A, B, C, D, E, F, G] {
9✔
485
        ids := []ID{
9✔
486
                ComponentID[A](world),
9✔
487
                ComponentID[B](world),
9✔
488
                ComponentID[C](world),
9✔
489
                ComponentID[D](world),
9✔
490
                ComponentID[E](world),
9✔
491
                ComponentID[F](world),
9✔
492
                ComponentID[G](world),
9✔
493
        }
9✔
494

9✔
495
        return &Filter7[A, B, C, D, E, F, G]{
9✔
496
                world:  world,
9✔
497
                ids:    ids,
9✔
498
                filter: NewFilter(ids...),
9✔
499
        }
9✔
500
}
9✔
501

502
// With specifies additional components to filter for.
503
func (f *Filter7[A, B, C, D, E, F, G]) With(comps ...Comp) *Filter7[A, B, C, D, E, F, G] {
1✔
504
        for _, c := range comps {
2✔
505
                id := f.world.componentID(c.tp)
1✔
506
                f.filter.mask.Set(id, true)
1✔
507
        }
1✔
508
        return f
1✔
509
}
510

511
// Without specifies components to exclude.
512
func (f *Filter7[A, B, C, D, E, F, G]) Without(comps ...Comp) *Filter7[A, B, C, D, E, F, G] {
1✔
513
        for _, c := range comps {
2✔
514
                id := f.world.componentID(c.tp)
1✔
515
                f.filter.without.Set(id, true)
1✔
516
                f.filter.hasWithout = true
1✔
517
        }
1✔
518
        return f
1✔
519
}
520

521
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
522
// and no other components are allowed.
523
func (f *Filter7[A, B, C, D, E, F, G]) Exclusive() *Filter7[A, B, C, D, E, F, G] {
1✔
524
        f.filter = f.filter.Exclusive()
1✔
525
        return f
1✔
526
}
1✔
527

528
// Query creates a [Query7] from this filter.
529
// This must be used each time before iterating a query.
530
func (f *Filter7[A, B, C, D, E, F, G]) Query(rel ...RelationIndex) Query7[A, B, C, D, E, F, G] {
9✔
531
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
9✔
532
        return newQuery7[A, B, C, D, E, F, G](f.world, f.filter, f.ids, f.relations)
9✔
533
}
9✔
534

535
// Batch creates a [Batch] from this filter.
536
func (f *Filter7[A, B, C, D, E, F, G]) Batch(rel ...RelationIndex) Batch {
1✔
537
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
538
        return Batch{
1✔
539
                filter:    f.filter,
1✔
540
                relations: f.relations,
1✔
541
        }
1✔
542
}
1✔
543

544
// Filter8 is a filter for 8 components.
545
type Filter8[A any, B any, C any, D any, E any, F any, G any, H any] struct {
546
        world     *World
547
        ids       []ID
548
        filter    Filter
549
        relations []RelationID
550
}
551

552
// NewFilter8 creates a new [Filter8].
553
//
554
// Use [Filter8.Query] to obtain a [Query8].
555
func NewFilter8[A any, B any, C any, D any, E any, F any, G any, H any](world *World) *Filter8[A, B, C, D, E, F, G, H] {
9✔
556
        ids := []ID{
9✔
557
                ComponentID[A](world),
9✔
558
                ComponentID[B](world),
9✔
559
                ComponentID[C](world),
9✔
560
                ComponentID[D](world),
9✔
561
                ComponentID[E](world),
9✔
562
                ComponentID[F](world),
9✔
563
                ComponentID[G](world),
9✔
564
                ComponentID[H](world),
9✔
565
        }
9✔
566

9✔
567
        return &Filter8[A, B, C, D, E, F, G, H]{
9✔
568
                world:  world,
9✔
569
                ids:    ids,
9✔
570
                filter: NewFilter(ids...),
9✔
571
        }
9✔
572
}
9✔
573

574
// With specifies additional components to filter for.
575
func (f *Filter8[A, B, C, D, E, F, G, H]) With(comps ...Comp) *Filter8[A, B, C, D, E, F, G, H] {
1✔
576
        for _, c := range comps {
2✔
577
                id := f.world.componentID(c.tp)
1✔
578
                f.filter.mask.Set(id, true)
1✔
579
        }
1✔
580
        return f
1✔
581
}
582

583
// Without specifies components to exclude.
584
func (f *Filter8[A, B, C, D, E, F, G, H]) Without(comps ...Comp) *Filter8[A, B, C, D, E, F, G, H] {
1✔
585
        for _, c := range comps {
2✔
586
                id := f.world.componentID(c.tp)
1✔
587
                f.filter.without.Set(id, true)
1✔
588
                f.filter.hasWithout = true
1✔
589
        }
1✔
590
        return f
1✔
591
}
592

593
// Exclusive makes the filter exclusive in the sense that the component composition is matched exactly,
594
// and no other components are allowed.
595
func (f *Filter8[A, B, C, D, E, F, G, H]) Exclusive() *Filter8[A, B, C, D, E, F, G, H] {
1✔
596
        f.filter = f.filter.Exclusive()
1✔
597
        return f
1✔
598
}
1✔
599

600
// Query creates a [Query8] from this filter.
601
// This must be used each time before iterating a query.
602
func (f *Filter8[A, B, C, D, E, F, G, H]) Query(rel ...RelationIndex) Query8[A, B, C, D, E, F, G, H] {
9✔
603
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
9✔
604
        return newQuery8[A, B, C, D, E, F, G, H](f.world, f.filter, f.ids, f.relations)
9✔
605
}
9✔
606

607
// Batch creates a [Batch] from this filter.
608
func (f *Filter8[A, B, C, D, E, F, G, H]) Batch(rel ...RelationIndex) Batch {
1✔
609
        f.relations = relations(rel).toRelations(&f.world.storage.registry, f.ids, f.relations)
1✔
610
        return Batch{
1✔
611
                filter:    f.filter,
1✔
612
                relations: f.relations,
1✔
613
        }
1✔
614
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc