What's new
solana-zero-copy is the new home for zero-copy primitive wrappers previously developed inside spl-pod. It is a
no_std crate for stable-layout, unaligned primitive wrapper types used in Solana zero-copy data structures.
The reserved-null data structure has been split into the companion solana-nullable crate.
Migration notes
spl-pod will essentially be deprecated, but an upcoming patch release that will re-export from solana-zero-copy
in a backwards-compatible way.
Changes
If you are coming from spl-pod, here is the rough mapping:
| Concept | New home |
|---|---|
| Unaligned primitive wrappers | solana-zero-copy
|
| Reserved-null option semantics | solana-nullable
|
Primitive wrappers are renamed as follows:
spl-pod
| solana-zero-copy
|
|---|---|
spl_pod::primitives::PodBool
| solana_zero_copy::unaligned::Bool
|
spl_pod::primitives::PodU16
| solana_zero_copy::unaligned::U16
|
spl_pod::primitives::PodI16
| solana_zero_copy::unaligned::I16
|
spl_pod::primitives::PodU32
| solana_zero_copy::unaligned::U32
|
spl_pod::primitives::PodU64
| solana_zero_copy::unaligned::U64
|
spl_pod::primitives::PodI64
| solana_zero_copy::unaligned::I64
|
spl_pod::primitives::PodU128
| solana_zero_copy::unaligned::U128
|
The old Pod* prefixes have been dropped in favor of shorter names scoped under the unaligned module.
Other key changes to be aware of:
U128is unavailable on BPF targetsMaybeNullerrors changed. Conversions returnMaybeNullErrorinstead ofProgramError- No crate re-exports.
solana-address,solana-program-error, andsolana-program-optionare not re-exported and
those respective crates have their ownNullableimpl.