Skip to main content

Vec

Type Alias Vec 

Source
pub type Vec<T, const N: usize> = PodVec<T, N, 2>;
Expand description

Schema-friendly vector with a two-byte length prefix.

This is an alias, not a separate type: it is PodVec with PFX = 2, and its elements are the mapped pods of T, so Vec<u64, 8> stores PodU64 elements. Use pod::PodVec directly when the wire format needs an explicit prefix width, for example PodVec<u64, 1024, 4>.

PFX is the width in bytes of the length prefix or tag that precedes the payload, and it must be 1, 2, 4, or 8.

The element count must fit that prefix: Vec<u64, 255> is valid, Vec<u64, 256> is not, and PodVec<u64, 256, 2> restores it.

Choose the capacity from the largest value the schema must hold, because a write that does not fit is rejected rather than truncated.

Aliased Typeยง

pub struct Vec<T, const N: usize> { /* private fields */ }