Expand description
Alignment-safe primitive wrappers that can be used in Pod structs.
Pod types (PodU64, PodU32, etc.) wrap native integers in [u8; N]
arrays, guaranteeing alignment 1. This allows direct pointer casts from
account data without alignment concerns — critical for #[repr(C)]
zero-copy structs on Solana.
§Arithmetic
Arithmetic operators (+, -, *) use wrapping semantics in release
builds for CU efficiency and panic on overflow in debug builds. Use
checked_add, checked_sub, checked_mul, checked_div where overflow
must be detected in all build profiles.
§Constants
Each Pod integer type provides ZERO, MIN, and MAX constants.
Macros§
- impl_
int_ conversion - Implements bidirectional conversion between a
Pod*wrapper type and its corresponding standard integer.
Structs§
- PodBool
- The standard
boolis not aPod, define a replacement that is. - PodI16
- An alignment-1 wrapper around
i16stored as[u8; 2]. - PodI32
- An alignment-1 wrapper around
i32stored as[u8; 4]. - PodI64
- An alignment-1 wrapper around
i64stored as[u8; 8]. - PodI128
- An alignment-1 wrapper around
i128stored as[u8; 16]. - PodU16
- An alignment-1 wrapper around
u16stored as[u8; 2]. - PodU32
- An alignment-1 wrapper around
u32stored as[u8; 4]. - PodU64
- An alignment-1 wrapper around
u64stored as[u8; 8]. - PodU128
- An alignment-1 wrapper around
u128stored as[u8; 16].