You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Which issue does this PR close?
* Closes#7684
* Closes#7685
* Part of #6736
# Rationale for this change
Infallible iteration is _much_ easier to work with, vs. Iterator of
Result or Result of Iterator. Iteration and validation are strongly
correlated, because the iterator can only be infallible if the
constructor previously validated everything the iterator depends on.
# What changes are included in this PR?
In all three of `VariantMetadata,` `VariantList,` and `VariantObject`:
* The header object is cleaned up to _only_ consider actual header
state. Other state is moved to the object itself.
* Constructors fully validate the object by consuming a fallible
iterator
* The externally visible iterator does a `map(Result::unwrap)` on the
same fallible iterator, relying on the constructor to prove the unwrap
is safe.
* The externally visible iterator is obtained by calling `iter()`
method.
In addition:
* `VariantObject` methods no longer materialize the whole offset+field
array
* Removed validation that is covered by the new iterator testing
* A bunch of dead code removed, several methods renamed for clarity
* `first_byte_from_slice` now returns `u8` instead of `&u8`
# Are there any user-facing changes?
Visibility and signatures of some methods changed.
---------
Co-authored-by: Andrew Lamb <[email protected]>
0 commit comments