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

mlange-42 / ark / 13522665831

25 Feb 2025 01:43PM CUT coverage: 83.258%. Remained the same
13522665831

Pull #69

github

web-flow
Merge fca34835f into 747bd4f00
Pull Request #69: Add test coverage badge to README

2954 of 3548 relevant lines covered (83.26%)

52188.13 hits per line

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

9.48
/ecs/exchange_gen.go
1
package ecs
2

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

5
import "unsafe"
6

7
// Exchange1 allows to exchange components of entities.
8
// It adds the given components. Use [Exchange1.Removes]
9
// to set components to be removed.
10
type Exchange1[A any] struct {
11
        world     *World
12
        ids       []ID
13
        remove    []ID
14
        relations []relationID
15
}
16

17
// NewExchange1 creates an [Exchange1].
18
func NewExchange1[A any](world *World) *Exchange1[A] {
1✔
19
        ids := []ID{
1✔
20
                ComponentID[A](world),
1✔
21
        }
1✔
22
        return &Exchange1[A]{
1✔
23
                world: world,
1✔
24
                ids:   ids,
1✔
25
        }
1✔
26
}
1✔
27

28
// Removes sets the components that this [Exchange1] removes.
29
func (ex *Exchange1[A]) Removes(components ...Comp) *Exchange1[A] {
1✔
30
        ids := make([]ID, len(components))
1✔
31
        for i, c := range components {
3✔
32
                ids[i] = ex.world.componentID(c.tp)
2✔
33
        }
2✔
34
        ex.remove = ids
1✔
35
        return ex
1✔
36
}
37

38
// Exchange performs the exchange on the given entity, adding the provided components
39
// and removing those previously specified with [Exchange1.Removes].
40
func (ex *Exchange1[A]) Exchange(entity Entity, a *A, rel ...RelationIndex) {
1✔
41
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
1✔
42
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
1✔
43
                unsafe.Pointer(a),
1✔
44
        }, ex.relations)
1✔
45
}
1✔
46

47
// Exchange2 allows to exchange components of entities.
48
// It adds the given components. Use [Exchange2.Removes]
49
// to set components to be removed.
50
type Exchange2[A any, B any] struct {
51
        world     *World
52
        ids       []ID
53
        remove    []ID
54
        relations []relationID
55
}
56

57
// NewExchange2 creates an [Exchange2].
58
func NewExchange2[A any, B any](world *World) *Exchange2[A, B] {
×
59
        ids := []ID{
×
60
                ComponentID[A](world),
×
61
                ComponentID[B](world),
×
62
        }
×
63
        return &Exchange2[A, B]{
×
64
                world: world,
×
65
                ids:   ids,
×
66
        }
×
67
}
×
68

69
// Removes sets the components that this [Exchange2] removes.
70
func (ex *Exchange2[A, B]) Removes(components ...Comp) *Exchange2[A, B] {
×
71
        ids := make([]ID, len(components))
×
72
        for i, c := range components {
×
73
                ids[i] = ex.world.componentID(c.tp)
×
74
        }
×
75
        ex.remove = ids
×
76
        return ex
×
77
}
78

79
// Exchange performs the exchange on the given entity, adding the provided components
80
// and removing those previously specified with [Exchange2.Removes].
81
func (ex *Exchange2[A, B]) Exchange(entity Entity, a *A, b *B, rel ...RelationIndex) {
×
82
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
83
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
84
                unsafe.Pointer(a),
×
85
                unsafe.Pointer(b),
×
86
        }, ex.relations)
×
87
}
×
88

89
// Exchange3 allows to exchange components of entities.
90
// It adds the given components. Use [Exchange3.Removes]
91
// to set components to be removed.
92
type Exchange3[A any, B any, C any] struct {
93
        world     *World
94
        ids       []ID
95
        remove    []ID
96
        relations []relationID
97
}
98

99
// NewExchange3 creates an [Exchange3].
100
func NewExchange3[A any, B any, C any](world *World) *Exchange3[A, B, C] {
×
101
        ids := []ID{
×
102
                ComponentID[A](world),
×
103
                ComponentID[B](world),
×
104
                ComponentID[C](world),
×
105
        }
×
106
        return &Exchange3[A, B, C]{
×
107
                world: world,
×
108
                ids:   ids,
×
109
        }
×
110
}
×
111

112
// Removes sets the components that this [Exchange3] removes.
113
func (ex *Exchange3[A, B, C]) Removes(components ...Comp) *Exchange3[A, B, C] {
×
114
        ids := make([]ID, len(components))
×
115
        for i, c := range components {
×
116
                ids[i] = ex.world.componentID(c.tp)
×
117
        }
×
118
        ex.remove = ids
×
119
        return ex
×
120
}
121

122
// Exchange performs the exchange on the given entity, adding the provided components
123
// and removing those previously specified with [Exchange3.Removes].
124
func (ex *Exchange3[A, B, C]) Exchange(entity Entity, a *A, b *B, c *C, rel ...RelationIndex) {
×
125
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
126
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
127
                unsafe.Pointer(a),
×
128
                unsafe.Pointer(b),
×
129
                unsafe.Pointer(c),
×
130
        }, ex.relations)
×
131
}
×
132

133
// Exchange4 allows to exchange components of entities.
134
// It adds the given components. Use [Exchange4.Removes]
135
// to set components to be removed.
136
type Exchange4[A any, B any, C any, D any] struct {
137
        world     *World
138
        ids       []ID
139
        remove    []ID
140
        relations []relationID
141
}
142

143
// NewExchange4 creates an [Exchange4].
144
func NewExchange4[A any, B any, C any, D any](world *World) *Exchange4[A, B, C, D] {
×
145
        ids := []ID{
×
146
                ComponentID[A](world),
×
147
                ComponentID[B](world),
×
148
                ComponentID[C](world),
×
149
                ComponentID[D](world),
×
150
        }
×
151
        return &Exchange4[A, B, C, D]{
×
152
                world: world,
×
153
                ids:   ids,
×
154
        }
×
155
}
×
156

157
// Removes sets the components that this [Exchange4] removes.
158
func (ex *Exchange4[A, B, C, D]) Removes(components ...Comp) *Exchange4[A, B, C, D] {
×
159
        ids := make([]ID, len(components))
×
160
        for i, c := range components {
×
161
                ids[i] = ex.world.componentID(c.tp)
×
162
        }
×
163
        ex.remove = ids
×
164
        return ex
×
165
}
166

167
// Exchange performs the exchange on the given entity, adding the provided components
168
// and removing those previously specified with [Exchange4.Removes].
169
func (ex *Exchange4[A, B, C, D]) Exchange(entity Entity, a *A, b *B, c *C, d *D, rel ...RelationIndex) {
×
170
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
171
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
172
                unsafe.Pointer(a),
×
173
                unsafe.Pointer(b),
×
174
                unsafe.Pointer(c),
×
175
                unsafe.Pointer(d),
×
176
        }, ex.relations)
×
177
}
×
178

179
// Exchange5 allows to exchange components of entities.
180
// It adds the given components. Use [Exchange5.Removes]
181
// to set components to be removed.
182
type Exchange5[A any, B any, C any, D any, E any] struct {
183
        world     *World
184
        ids       []ID
185
        remove    []ID
186
        relations []relationID
187
}
188

189
// NewExchange5 creates an [Exchange5].
190
func NewExchange5[A any, B any, C any, D any, E any](world *World) *Exchange5[A, B, C, D, E] {
×
191
        ids := []ID{
×
192
                ComponentID[A](world),
×
193
                ComponentID[B](world),
×
194
                ComponentID[C](world),
×
195
                ComponentID[D](world),
×
196
                ComponentID[E](world),
×
197
        }
×
198
        return &Exchange5[A, B, C, D, E]{
×
199
                world: world,
×
200
                ids:   ids,
×
201
        }
×
202
}
×
203

204
// Removes sets the components that this [Exchange5] removes.
205
func (ex *Exchange5[A, B, C, D, E]) Removes(components ...Comp) *Exchange5[A, B, C, D, E] {
×
206
        ids := make([]ID, len(components))
×
207
        for i, c := range components {
×
208
                ids[i] = ex.world.componentID(c.tp)
×
209
        }
×
210
        ex.remove = ids
×
211
        return ex
×
212
}
213

214
// Exchange performs the exchange on the given entity, adding the provided components
215
// and removing those previously specified with [Exchange5.Removes].
216
func (ex *Exchange5[A, B, C, D, E]) Exchange(entity Entity, a *A, b *B, c *C, d *D, e *E, rel ...RelationIndex) {
×
217
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
218
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
219
                unsafe.Pointer(a),
×
220
                unsafe.Pointer(b),
×
221
                unsafe.Pointer(c),
×
222
                unsafe.Pointer(d),
×
223
                unsafe.Pointer(e),
×
224
        }, ex.relations)
×
225
}
×
226

227
// Exchange6 allows to exchange components of entities.
228
// It adds the given components. Use [Exchange6.Removes]
229
// to set components to be removed.
230
type Exchange6[A any, B any, C any, D any, E any, F any] struct {
231
        world     *World
232
        ids       []ID
233
        remove    []ID
234
        relations []relationID
235
}
236

237
// NewExchange6 creates an [Exchange6].
238
func NewExchange6[A any, B any, C any, D any, E any, F any](world *World) *Exchange6[A, B, C, D, E, F] {
×
239
        ids := []ID{
×
240
                ComponentID[A](world),
×
241
                ComponentID[B](world),
×
242
                ComponentID[C](world),
×
243
                ComponentID[D](world),
×
244
                ComponentID[E](world),
×
245
                ComponentID[F](world),
×
246
        }
×
247
        return &Exchange6[A, B, C, D, E, F]{
×
248
                world: world,
×
249
                ids:   ids,
×
250
        }
×
251
}
×
252

253
// Removes sets the components that this [Exchange6] removes.
254
func (ex *Exchange6[A, B, C, D, E, F]) Removes(components ...Comp) *Exchange6[A, B, C, D, E, F] {
×
255
        ids := make([]ID, len(components))
×
256
        for i, c := range components {
×
257
                ids[i] = ex.world.componentID(c.tp)
×
258
        }
×
259
        ex.remove = ids
×
260
        return ex
×
261
}
262

263
// Exchange performs the exchange on the given entity, adding the provided components
264
// and removing those previously specified with [Exchange6.Removes].
265
func (ex *Exchange6[A, B, C, D, E, F]) Exchange(entity Entity, a *A, b *B, c *C, d *D, e *E, f *F, rel ...RelationIndex) {
×
266
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
267
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
268
                unsafe.Pointer(a),
×
269
                unsafe.Pointer(b),
×
270
                unsafe.Pointer(c),
×
271
                unsafe.Pointer(d),
×
272
                unsafe.Pointer(e),
×
273
                unsafe.Pointer(f),
×
274
        }, ex.relations)
×
275
}
×
276

277
// Exchange7 allows to exchange components of entities.
278
// It adds the given components. Use [Exchange7.Removes]
279
// to set components to be removed.
280
type Exchange7[A any, B any, C any, D any, E any, F any, G any] struct {
281
        world     *World
282
        ids       []ID
283
        remove    []ID
284
        relations []relationID
285
}
286

287
// NewExchange7 creates an [Exchange7].
288
func NewExchange7[A any, B any, C any, D any, E any, F any, G any](world *World) *Exchange7[A, B, C, D, E, F, G] {
×
289
        ids := []ID{
×
290
                ComponentID[A](world),
×
291
                ComponentID[B](world),
×
292
                ComponentID[C](world),
×
293
                ComponentID[D](world),
×
294
                ComponentID[E](world),
×
295
                ComponentID[F](world),
×
296
                ComponentID[G](world),
×
297
        }
×
298
        return &Exchange7[A, B, C, D, E, F, G]{
×
299
                world: world,
×
300
                ids:   ids,
×
301
        }
×
302
}
×
303

304
// Removes sets the components that this [Exchange7] removes.
305
func (ex *Exchange7[A, B, C, D, E, F, G]) Removes(components ...Comp) *Exchange7[A, B, C, D, E, F, G] {
×
306
        ids := make([]ID, len(components))
×
307
        for i, c := range components {
×
308
                ids[i] = ex.world.componentID(c.tp)
×
309
        }
×
310
        ex.remove = ids
×
311
        return ex
×
312
}
313

314
// Exchange performs the exchange on the given entity, adding the provided components
315
// and removing those previously specified with [Exchange7.Removes].
316
func (ex *Exchange7[A, B, C, D, E, F, G]) Exchange(entity Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, rel ...RelationIndex) {
×
317
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
318
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
319
                unsafe.Pointer(a),
×
320
                unsafe.Pointer(b),
×
321
                unsafe.Pointer(c),
×
322
                unsafe.Pointer(d),
×
323
                unsafe.Pointer(e),
×
324
                unsafe.Pointer(f),
×
325
                unsafe.Pointer(g),
×
326
        }, ex.relations)
×
327
}
×
328

329
// Exchange8 allows to exchange components of entities.
330
// It adds the given components. Use [Exchange8.Removes]
331
// to set components to be removed.
332
type Exchange8[A any, B any, C any, D any, E any, F any, G any, H any] struct {
333
        world     *World
334
        ids       []ID
335
        remove    []ID
336
        relations []relationID
337
}
338

339
// NewExchange8 creates an [Exchange8].
340
func NewExchange8[A any, B any, C any, D any, E any, F any, G any, H any](world *World) *Exchange8[A, B, C, D, E, F, G, H] {
×
341
        ids := []ID{
×
342
                ComponentID[A](world),
×
343
                ComponentID[B](world),
×
344
                ComponentID[C](world),
×
345
                ComponentID[D](world),
×
346
                ComponentID[E](world),
×
347
                ComponentID[F](world),
×
348
                ComponentID[G](world),
×
349
                ComponentID[H](world),
×
350
        }
×
351
        return &Exchange8[A, B, C, D, E, F, G, H]{
×
352
                world: world,
×
353
                ids:   ids,
×
354
        }
×
355
}
×
356

357
// Removes sets the components that this [Exchange8] removes.
358
func (ex *Exchange8[A, B, C, D, E, F, G, H]) Removes(components ...Comp) *Exchange8[A, B, C, D, E, F, G, H] {
×
359
        ids := make([]ID, len(components))
×
360
        for i, c := range components {
×
361
                ids[i] = ex.world.componentID(c.tp)
×
362
        }
×
363
        ex.remove = ids
×
364
        return ex
×
365
}
366

367
// Exchange performs the exchange on the given entity, adding the provided components
368
// and removing those previously specified with [Exchange8.Removes].
369
func (ex *Exchange8[A, B, C, D, E, F, G, H]) Exchange(entity Entity, a *A, b *B, c *C, d *D, e *E, f *F, g *G, h *H, rel ...RelationIndex) {
×
370
        ex.relations = relations(rel).toRelations(&ex.world.storage.registry, ex.ids, ex.relations)
×
371
        ex.world.exchange(entity, ex.ids, ex.remove, []unsafe.Pointer{
×
372
                unsafe.Pointer(a),
×
373
                unsafe.Pointer(b),
×
374
                unsafe.Pointer(c),
×
375
                unsafe.Pointer(d),
×
376
                unsafe.Pointer(e),
×
377
                unsafe.Pointer(f),
×
378
                unsafe.Pointer(g),
×
379
                unsafe.Pointer(h),
×
380
        }, ex.relations)
×
381
}
×
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