Closed doubledup closed 1 year ago
I've gone with try_from
, unwrap
and a safety comment for now. This way we keep the single entry point and unwrap
is addressed in the same way as the other uses.
As an aside, are a List[type, 0]
and Bitlist[0]
valid? The spec makes this exclusion for the vector types, but not the lists. Seems like a reasonable exclusion because the lists would have to be empty.
As an aside, are a List[type, 0] and Bitlist[0] valid?
I ran into the same question the other day haha
the spec says they are valid via omission and while they are strange types I don't see a problem w/ them
I'd have to go review the spec to say more but the high-level idea is that we don't want "empty" fixed sized types but variably-sized types are fine
Patch coverage: 14.77
% and project coverage change: -16.12
:warning:
Comparison is base (
9cc2fb1
) 59.91% compared to head (0135d8e
) 43.80%.:exclamation: Current head 0135d8e differs from pull request most recent head e42bbfc. Consider uploading reports for the commit e42bbfc to get more accurate results
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
These panic cases shouldn't have come up in practice, but removing them from the source ensures they can't.
Also did a pass over the other
default
implementations, but there aren't any explicit panics and the functions used look safe. An exception isBitVector
that has anassert!
forN > 0
- I've added the same assert toVector
. An initial attempt to move this to a compile-time check with static_assertions gave some errors I couldn't easily interpret, so left it for now.