Expand description
Dynamic array (Vec<T>) implementation for the storage traits.
ยงStorage Layout
Vec uses Solidity-compatible dynamic array storage:
- Base slot: Stores the array length (number of elements)
- Data slots: Start at
keccak256(len_slot), elements packed efficiently
ยงMulti-Slot Support
- Supports both single-slot primitives and multi-slot types (structs, arrays)
- Element at index
istarts at slotdata_start + i * T::SLOTS
Structsยง
- VecHandler
- Type-safe handler for accessing
Vec<T>in storage.
Functionsยง
- build_
packed_ ๐slot - Build a packed storage slot from multiple elements.
- calc_
data_ ๐slot - Calculate the starting slot for dynamic array data.
- load_
packed_ ๐elements - Load packed elements from storage.
- load_
unpacked_ ๐elements - Load unpacked elements from storage.
- store_
packed_ ๐elements - Store packed elements to storage.
- store_
unpacked_ ๐elements - Store unpacked elements to storage.