amethyst / hibitset

Hierarchical bit set container
Other
118 stars 33 forks source link

Generic layers [WIP] #29

Open WaDelma opened 6 years ago

WaDelma commented 6 years ago

extends from #28 (Because I wanted to also make API in it to work)

This is an experimental PR trying to make the amount of layers in bitset generic using typenum.

Currently most of the 4 layered bitset tests work, but no other layer amounts are being tested. Currently 1 is allowed for the amount of layers, which would break all of the logic. (The top layer is separate so 0 in generic parameter means 1 layers: This should be improved). This change needs complete resign of BitSetLike trait. It also hasn't done anything to the atomic variant.

WaDelma commented 6 years ago

I think I got it working, but it's not that polished. Also it degrades it's usage: You have to always provide the amount of layers you want. I added defaults, but for some reason rust doesn't take them into account.

torkleyy commented 6 years ago

I've redecided; initially I was skeptical, but now I think this is a very useful addition.

torkleyy commented 6 years ago

@WaDelma Can you estimate how long you're going to work on this?

WaDelma commented 6 years ago

Not completely sure: I have to check how the change would affect specs. Biggest blocker is that type defaults don't seem to work and you need to specify the size of BitSet when you use it. I should probably just add type aliases for common sizes and side step the problem.

I also have to make sure that documentation is up to date and that all of the tests are run on different sizes. After that it should be ready.

torkleyy commented 6 years ago

Defaults really should work, I've used them a couple of times before.