Expand description
This crate provides serialization and deserialization functionality for the data types used by the Tezos shell.
You can either implement [NomReader] and [BinWriter] manually, or derive them.
§Examples
Let’s create encodings for a struct containing two arrays - one of fixed size, and one dynamic.
Derivation is supported across generic structs.
use tezos_data_encoding::nom::NomReader;
use tezos_data_encoding::enc::BinWriter;
use tezos_data_encoding::encoding::HasEncoding;
const INNER_SIZE: usize = 10;
#[derive(Debug, PartialEq, HasEncoding, NomReader, BinWriter)]
struct Inner {
  #[encoding(sized = "INNER_SIZE", bytes)]
  fixed_size: Vec<u8>
}
#[derive(Debug, PartialEq, HasEncoding, NomReader, BinWriter)]
struct Outer<T>
where T: Debug + PartialEq + HasEncoding + for<'a> NomReader<'a> + BinWriter {
  #[encoding(dynamic)]
  dynamic_size: Vec<T>
}Modules§
- binary_
reader  - Tezos binary data reader.
 - binary_
writer  - Tezos binary data writer.
 - enc
 - encoding
 - Schema used for serialization and deserialization.
 - nom
 - types
 - Defines types of the intermediate data format.
 
Macros§
- has_
encoding  - Creates impl HasEncoding for given struct backed by lazy_static ref instance with encoding.