pub fn zcash_serialize_external_count<W: Write, T: ZcashSerialize>(
    vec: &Vec<T>,
    writer: W,
) -> Result<(), Error>
Expand description

Serialize a typed Vec without writing the number of items as a CompactSize.

In Zcash, most arrays are stored as a CompactSize, followed by that number of items of type T. But in Transaction::V5, some types are serialized as multiple arrays in different locations, with a single CompactSize before the first array.

§Usage

Use zcash_serialize_external_count when the array count is determined by other data, or a consensus rule.

Use Vec::zcash_serialize for data that contains CompactSize count, followed by the data array.

For example, when a single count applies to multiple arrays:

  1. Use Vec::zcash_serialize for the array that has a data count.
  2. Use zcash_serialize_external_count for the arrays with no count in the data, passing the length of the first array.

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.