This (draft, at the time of writing) PR makes the following changes in an attempt to improve code quality in areas of the codebase that are related to svm-codec:
Reduce macro usage; implement a trait BytesPrimitive: AsRef<[u8]> + AsMut<[u8]> for Address, TemplateAddr, State and others.
Leverage the new BytesPrimitive trait to implement common features with generics, as well as unifying encoding and decoding logic.
Unify encode_xyz and decode_xyz functions in svm_codec under a Codec trait. This helps discoverability, can benefit from writing generic unit tests and improves error handling.
Overhaul the wasm API. Rewrite buffering logic with safety in mind and greatly reduce amount of code.
Exploratory work for providing a Typescript typed wrapper around svm_codec::api::wasm.
This (draft, at the time of writing) PR makes the following changes in an attempt to improve code quality in areas of the codebase that are related to
svm-codec
:BytesPrimitive: AsRef<[u8]> + AsMut<[u8]>
forAddress
,TemplateAddr
,State
and others.BytesPrimitive
trait to implement common features with generics, as well as unifying encoding and decoding logic.encode_xyz
anddecode_xyz
functions insvm_codec
under aCodec
trait. This helps discoverability, can benefit from writing generic unit tests and improves error handling.wasm
API. Rewrite buffering logic with safety in mind and greatly reduce amount of code.svm_codec::api::wasm
.