Skip to main content

Module compact

Module compact 

Source
Expand description

Tier 1 of the three-tier metadata model: compact account access.

See the repository’s three-tier metadata design.

A compact account stores exactly one discriminator byte followed by the zero-copy body:

byte 0   : disc (u8)
bytes 1..: zero-copy body (alignment-1 Pod fields)

There is no 16-byte universal header. The hot path is check_len_exact + check_disc + cast-body-at-offset-1: no layout_id read, no schema-epoch comparison, no registry fetch. Identity of the layout behind a discriminator is a program-level fact (Tier 2 / Tier 3), not a per-account one.

This is additive: the 16-byte-header crate::layout::LayoutContract path is unchanged and remains the default. A type opts into compact by implementing CompactLayout; the two are distinguished by which loader the caller invokes.

Constants§

COMPACT_BODY_OFFSET
Byte offset of a compact account body (immediately after the 1-byte discriminator).

Traits§

CompactDynamicLayout
A compact account with a fixed zero-copy head followed by a dynamic tail:
CompactLayout
A zero-copy account layout stored in compact [disc:u8][body] form.