v0.4.6
is a minor feature release that brings a cleaner workflow for implementing custom decoding with the Depolorizable
interface. Previously this required some verbosity to be a concrete implementation (see below for more). This release also adds independent decode methods for all integer sizes to allow more brevity when decoding directly into struct fields. Additionally significant improvements have been made to the unit tests to be independently runnable and go-polo
is now back to 100% test coverage!
Clean Custom Depolorization
Depolorizer
now has some behaviors to support a simpler workflow when custom decoding to structs. Previously a call toDepolorizer.DepolorizePacked
was necessary to decompose the outer wire's pack element into its ownDepolorizer
and this method returned anErrNullPack
to indicate that the wire element is null and cannot be unpacked.- Now,
Depolorizer.DepolorizePacked
is strict and does not allow theWireNull
type and now returns theIncompatibleWire
error if it encounters it. This makes the behavior easier to debug for unfamiliar users. This is enhanced by the fact that this same capability can be achieved with the newUnpacked
method that acts as a mirror to thePolorizer.Packed
method - Additionally a new method
Depolorizer.IsNull
peeks the next element in the wire and returns true if it is a WireNull. Allowing a consumer to separately handle the nullity check of the wire when decoding from aDepolorizer
. It is still necessary to pop this element if further decoding is required and this can be achieved using theDepolorizer.DepolorizeNull
Changelog:
- v0.4.5...v0.4.6
- simplify depolorizer unpacking and null checks by @sarvalabs-manish in 5a50c26
- allow decode methods for all integer sizes by @sarvalabs-manish in 96142f3
- fix lint issues and upgrade lint workflow by @sarvalabs-manish in 076aad7
- allow independent test runs by @sarvalabs-manish in 36a8be5
- elevate test coverage to 100% by @sarvalabs-manish in 69de527