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 callers can preflight raw memory with this fallible helper first. Empty memory is treated as uninitialized and is safe for Cell::init to create. Callers retaining an existing record for recovery can use decode_stable_cell_payload followed by decode_stable_cell_ledger_record.