Closed sanbox-irl closed 2 years ago
Can you elaborate a bit on the use case? Does the particular identity of the Entity
matter? If not, maybe something like Entity::dangling()
would be most convenient.
Exactly -- currently I use a grid which is a vec of Vec<TacitcsCell>
. TacitcsCell looks like this:
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum TacticsCell {
Empty,
Unit(Entity),
Tile,
}
in some unit tests, where I need to generate an Entity
, I do this:
TacticsCell::Unit(Entity::from_bits(123456789875).unwrap())
I don't care about that value, I just know it's big enough to satisfy the bit pattern. So changing it to Entity::dangling
would be excellent (there isn't even a World
that the entity could be a part of)
Heya,
While testing code that interacts with
hecs
, I occasionally have code that references entities which would be provided, but which I need to make during a test. I can do the bit shift and usefrom_bits
myself, but it's obviously a lot simply to just expose anew