Module bitcoin::consensus::serde

source ·
Expand description

Serde serialization via consensus encoding

This provides functions for (de)serializing any type as consensus-encoded bytes. For human-readable formats it serializes as a string with a consumer-supplied encoding, for binary formats it serializes as a sequence of bytes (not serialize_bytes to avoid allocations).

The string encoding has to be specified using a marker type implementing the encoding strategy. This crate provides hex encoding via Hex<Upper> and Hex<Lower>

Modules

  • Implements hex encoding.

Structs

  • Hex-encoding strategy
  • Helper for #[serde(with = "")].

Traits

  • Provides an instance of string-to-byte decoder.
  • Provides an instance of byte-to-string encoder.
  • Transforms given bytes and writes to the writer.
  • Converts error into a type implementing serde::de::Error