What's new
solana-nullable is the new home for Solana's reserved-null data structure. It's a compact, no_std way to represent
Option-like values without an extra tag byte.
This 1.0.0 release introduces two core building blocks:
Nullable— a trait for types that reserve a distinguished value to representNoneMaybeNull<T>— a transparent wrapper that gives anyNullabletypeOption<T>-like semantics using that
reserved value
Relationship to spl-pod and solana-zero-copy
Historically, spl-pod bundled two related ideas:
- Unaligned primitive wrappers for stable byte layout
- Reserved-null option semantics
Those are now split across two crates:
| Concern | New home |
|---|---|
| Unaligned primitive wrappers | solana-zero-copy
|
| Reserved-null option semantics | solana-nullable
|
Follow-up spl-pod release is expected to re-export from these SDK crates for backwards compatibility.
Migration from spl-pod
spl-pod
| solana-nullable
| Notes |
|---|---|---|
PodOption<T>
| MaybeNull<T>
| Renamed to describe value semantics directly |
Nullable trait
| Nullable trait
| Same role: defines the sentinel NONE value and is_none / is_some behavior
|
Conversions return ProgramError
| Conversions return MaybeNullError
| No longer coupled to the Solana program error type |
MaybeNull<T> serves the same purpose as PodOption<T>: represent Option<T> without increasing the size of T, as
long as T reserves a NONE sentinel value via the Nullable trait.