LPGhatguy / thunderdome

Arena type inspired by generational-arena
Apache License 2.0
197 stars 15 forks source link

`Index::from_bits` should return `Option<Index>` #31

Closed LPGhatguy closed 2 years ago

LPGhatguy commented 2 years ago

Currently, when given an invalid bit pattern, Index::from_bits will panic. This can happen with just Index::from_bits(0), for example.

In order to allow the Index type to be constructed from untrusted inputs safely, we should update Index::from_bits to return an Option<Index> and never panic.