Crate scale_encode
source ·Expand description
scale-encode
builds on parity-scale-codec
. parity-scale-codec
provides an Encode
trait
which allows types to SCALE encode themselves with no external information. scale-encode
provides an
EncodeAsType
trait which allows types to decide how to encode themselves based on the desired
target type.
Re-exports
pub use error::Error;
Modules
An error that is emitted whenever some encoding fails.
Some utility types that are useful in order to help implement
EncodeAsType
.Traits
This trait signals that some static type can possibly be SCALE encoded given some
type_id
and PortableRegistry
which dictates the expected encoding. A [Context
]
is also passed around, which is used internally to improve error reporting. Implementations
should use the [Context::at
] method to indicate the current location if they would like
it to show up in error output.Derive Macros
The
EncodeAsType
derive macro can be used to implement EncodeAsType
on structs and enums whose fields all implement EncodeAsType
.