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

mlange-42 / arche / 7577189746

18 Jan 2024 11:22PM CUT coverage: 100.0%. Remained the same
7577189746

push

github

web-flow
Exchange with relation targets, more batch ops (#342)

Adds methods to allow for exchanging components and setting relation targets at the same time. Includes batch operations and generic API.

* adds methods `Relations.Exchange()`, `Relations.ExchangeBatch()`, `Relations.ExchangeBatchQ()` for exchange with relation target
* adds `Exchange.WithRelation()` and optional target argument for operations with relation target
* adds `MapX.AddBatch()`, `MapX.AddBatchQ()`, `MapX.RemoveBatch()`and `MapX.RemoveBatchQ()`
* adds optional relation target argument to most `MapX` methods
* adds `FilterX.Filter()` to get an `ecs.Filter` from a generic one

6036 of 6036 relevant lines covered (100.0%)

53013.97 hits per line

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

100.0
/ecs/bitmask_common.go
1
package ecs
2

3
const wordSize = 64
4

5
// All creates a new Mask from a list of IDs.
6
// Matches all entities that have the respective components, and potentially further components.
7
//
8
// See also [Mask.Without] and [Mask.Exclusive]
9
//
10
// If any [ID] is greater than or equal to [MaskTotalBits], it will not be added to the mask.
11
func All(ids ...ID) Mask {
25,793✔
12
        var mask Mask
25,793✔
13
        for _, id := range ids {
51,997✔
14
                mask.Set(id, true)
26,204✔
15
        }
26,204✔
16
        return mask
25,793✔
17
}
18

19
// Matches the mask as filter against another mask.
20
func (b Mask) Matches(bits *Mask) bool {
77,104✔
21
        return bits.Contains(&b)
77,104✔
22
}
77,104✔
23

24
// Without creates a [MaskFilter] which filters for including the mask's components,
25
// and excludes the components given as arguments.
26
func (b Mask) Without(comps ...ID) MaskFilter {
7✔
27
        return MaskFilter{
7✔
28
                Include: b,
7✔
29
                Exclude: All(comps...),
7✔
30
        }
7✔
31
}
7✔
32

33
// Exclusive creates a [MaskFilter] which filters for exactly the mask's components.
34
// Matches only entities that have exactly the given components, and no other.
35
func (b Mask) Exclusive() MaskFilter {
6✔
36
        return MaskFilter{
6✔
37
                Include: b,
6✔
38
                Exclude: b.Not(),
6✔
39
        }
6✔
40
}
6✔
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