Expand description
Runtime-local segment primitive.
Segment stores an absolute byte offset and size in two u32 fields. It is
Copy, const-constructable, and carries no field name. The corresponding
hopper_core::segment_map::StaticSegment adds a name for schema and tooling
use.
§Design
Generated accessors can embed a Segment constant next to their layout
metadata:
- macros emit
const BALANCE: Segment = Segment::body(0, 8); - call sites read
account.segment_mut_const::<u64>(&mut b, BALANCE)? - the compiler can propagate the constant through bounds checks and pointer arithmetic.
Segment never appears in an on-chain layout, it is a compile-time
description only. Use hopper_core::account::SegmentDescriptor for
bytes that travel on the wire.
Structs§
- Field
Capability - Zero-sized field capability: type, byte offset, semantic role, and policy.
- Segment
- Compile-time descriptor of a typed byte range inside an account.
- Typed
Segment - Compile-time typed segment descriptor:
Tis the overlay type,OFFSETis the absolute byte offset from the start of account data. Zero-sized.
Constants§
- FIELD_
POLICY_ AUTHORITY_ GATED - Field mutations should be gated by an admin or authority proof.
- FIELD_
POLICY_ CHECKED_ MATH - Field mutations should use checked arithmetic.
- FIELD_
POLICY_ IMMUTABLE_ AFTER_ INIT - Field is intended to become immutable after initialization.
- FIELD_
ROLE_ AUTHORITY - Field carries authority or signer identity semantics.
- FIELD_
ROLE_ BALANCE - Field carries accounting or balance semantics.
- FIELD_
ROLE_ DATA - Generic field role for account field capability descriptors.
- FIELD_
ROLE_ VERSION - Field carries migration/versioning semantics.