Repository navigation
v0.5.0
0.5.0
This release shifts scale-decode to being a mirror of a new scale-encode crate, and:
- Adds a new
IntoVisitortrait that types can implement if there is aVisitorwhich can be used to decode
into them. - Adds a new
DecodeAsTypetrait to mirror theEncodeAsTypetrait there; any type that implementsIntoVisitor
automatically implementsDecodeAsType. - Adds a new
DecodeAsFieldstrait to mirrorEncodeAsFields, implemented for tuple and struct types. - Moves the
Visitortrait into a sub module and re-works the interface to allow zero copy decoding, allow more
concise implementations of it, and provide a fallback escape hatch to allow for more arbitraryDecodeAsType
implementations from it. - Implements
DecodeAsType(viaVisitorandIntoVisitorimpls) andDecodeAsFieldson common types. - Adds a
DecodeAsTypederive macro to auto-generate impls on custom struct and enum types.
Any Visitor impls will need to be updated to use the refined Visitor trait; this should be fairly mechanical
(check out the examples and follow the compiler guidance to do this). Otherwise, the rest of the changes are
additive and just make it easier to implement this trait and obtain a DecodeAsType implementation, if desired.
Changed
- Add DecodeAsType backed by Visitor impls for standard types. (#11)