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.
Structs
- This type represents named or unnamed composite values, and can be used to help generate
EncodeAsType
impls. It’s primarily used by the exported macros to do just that. - A read-only registry containing types in their portable form for serialization.
Traits
- This is similar to
EncodeAsType
, except that it’s can be implemented on types that can be encoded to bytes given a list of fields instead of a single type ID. This is generally implemented just for tuple and struct types, and is automatically implemented via theEncodeAsType
macro. - This trait signals that some static type can possibly be SCALE encoded given some
type_id
andPortableRegistry
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.
Type Definitions
- A description of a single field in a tuple or struct type.
Derive Macros
- The
EncodeAsType
derive macro can be used to implementEncodeAsType
on structs and enums whose fields all implementEncodeAsType
.