Skip to content

slot_size ​

Summary. Return the byte size of the serialized data currently held in a slot.

Signature.

c
int64_t slot_size(uint32_t slot);

Parameters.

NameTypeDescription
slotuint32_tSlot to measure.

Return value. Returns the serialized data length on success. Errors: DOESNT_EXIST (-5) if the slot is missing; INTERNAL_ERROR (-2) if the slot entry pointer is null.

Common failure patterns.

  • Measuring a cleared or never-set slot → DOESNT_EXIST.

Caveats / notes.

  • Size is computed by serializing the slot entry on each call (there's a noted RH TODO to cache it internally); prefer calling it once and reusing the result.
  • Use it to size a buffer before calling slot.

Minimal example.

c
int64_t n = slot_size(s);

Related APIs. slot, slot_set.