Module serlp::rlp

source · []

Structs

A RlpTree is a polytree, each node is either a value or a list. We build the tree by simulating the deserialization process with de::Deserializer.

Enums

Functions

This function deserialize a byte slice into a type. It works by construct a tree from the RLP encoded slice. When serde is deserializing each field, it will call the corresponding deserialize method, thus pops an element from the tree and decode it. A potential problem is the standard RLP encoding is not capable to enocde all Rust types, for example, variants. So you may need to implement your own deserialize trait for some variant types when nessessary. This function returns Error::MalformedData when the input is not valid RLP encoded bytes.

This function serialize a type instance into a byte vector with RLP encoding. Note that we treat all compund types in rust as list. Also, only explicitly values are encoded to keep consistence with the golang implementation. Here explicit values corresponds to implicit values, which means the values used as markers, such as enum variant indexes and type wrappers.