# Trait zebra_chain::serialization::ZcashDeserialize

pub trait ZcashDeserialize: Sized {
}
Expand description

Consensus-critical deserialization for Zcash.

This trait provides a generic deserialization for consensus-critical formats, such as network messages, transactions, blocks, etc.

It is intended for use only for consensus-critical formats. Internal deserialization can freely use serde, or any other format.

## Required Methods

Try to read self from the given reader.

This function has a zcash_ prefix to alert the reader that the serialization in use is consensus-critical serialization, rather than some other kind of serialization.

## Implementations on Foreign Types

Deserialize a Vec, where the number of items is set by a CompactSize prefix in the data. This is the most common format in Zcash.

See zcash_deserialize_external_count for more details, and usage information.

Implement ZcashDeserialize for Vec<u8> directly instead of using the blanket Vec implementation

This allows us to optimize the inner loop into a single call to read_exact() Note that we don’t implement TrustedPreallocate for u8. This allows the optimization without relying on specialization.

Deserialize an AtLeastOne vector, where the number of items is set by a CompactSize prefix in the data. This is the most common format in Zcash.