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.
Currently, when given an invalid bit pattern,
Index::from_bits
will panic. This can happen with justIndex::from_bits(0)
, for example.In order to allow the
Index
type to be constructed from untrusted inputs safely, we should updateIndex::from_bits
to return anOption<Index>
and never panic.