-
Notifications
You must be signed in to change notification settings - Fork 162
Closed
Description
I'm currently using bitflags to implement collision bitmasks in a game engine. Of course, since different games use collision for different things, I decided to try making my collider type generic over the mask type using the BitFlags trait. However, this didn't quite work:
error[E0369]: no implementation for `M & M`
--> triplicata/src/collision.rs:222:53
|
222 | what_collided: self.accept_mask & other.generate_mask,
| ---------------- ^ ------------------- M
| |
| M
|
help: consider further restricting this bound
|
157 | impl<M: BitFlags + std::ops::BitAnd<Output = M>> Hitbox<M> {
| ++++++++++++++++++++++++++++++
Since the types created by bitflags! always implement BitAnd (alongside several other traits), it might be convenient for BitFlags to subtrait BitAnd et al. Is this feasible?
(I realize I could probably just use BitAnd as a bound on its own in this case, but I'd like to push users towards using bitflags to define their bitmasks.)
cc #262
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels