pub fn mailbox_integer(
bytes: &[u8],
reserved_below: i64,
) -> Result<i64, RuntimeError>Expand description
Folds identifier bytes into a valid mailbox integer above a reserved range.
A component’s mailbox speaks integers, and its message protocol usually
claims the low ones (liveness, stop, news). When the host must send an
acknowledgement derived from an identifier — a stored entity id, for
example — the derivation has to land inside the BEAM small-integer term
payload AND above the protocol’s reserved values. This fold is that
derivation, absorbed from the generated composition host’s hand-rolled
Term::SMALL_INT_MAX arithmetic (finding B6): deterministic FNV-1a over
EVERY input byte (the hand-rolled version truncated to the first eight),
reduced into reserved_below ..= Term::SMALL_INT_MAX.
reserved_below states the caller’s protocol reservation: every integer
strictly below it is reserved and will never be returned. The returned
value is deterministic for identical inputs.
§Errors
Refuses a reserved_below outside 0..=Term::SMALL_INT_MAX — a negative
reservation is meaningless for a derived acknowledgement, and a bound past
the small-integer maximum leaves no valid value to fold into. Never a
clamp, never a silent wrap.