github anza-xyz/solana-sdk nullable@v1.0.0

latest releases: program-option@v3.1.0, address@v2.4.0
9 hours ago

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 represent None
  • MaybeNull<T> — a transparent wrapper that gives any Nullable type Option<T>-like semantics using that
    reserved value

Relationship to spl-pod and solana-zero-copy

Historically, spl-pod bundled two related ideas:

  1. Unaligned primitive wrappers for stable byte layout
  2. 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.

Don't miss a new solana-sdk release

NewReleases is sending notifications on new releases.