Skip to main content

validate_stable_cell_ledger_memory

Function validate_stable_cell_ledger_memory 

Source
pub fn validate_stable_cell_ledger_memory<M: Memory>(
    memory: &M,
) -> Result<(), StableCellLedgerError>
Expand description

Validate an existing stable-cell ledger record before opening it with ic-stable-structures::Cell.

Cell::init decodes the existing value through Storable::from_bytes. That trait is panic-based, so the runtime preflights the raw memory with this fallible helper first. Empty memory is treated as uninitialized and is safe for Cell::init to create.