Skip to main content

Module segment

Module segment 

Source
Expand description

Advanced segment and field-lease surface.

Structs§

Ref
RefMut
SegRef
Shared typed segment guard: a Ref<T> paired with a SegmentLease that releases the registry entry on drop.
SegRefMut
Exclusive typed segment guard.
Segment
Compile-time descriptor of a typed byte range inside an account.
SegmentBorrow
A single active segment borrow.
SegmentBorrowGuard
RAII guard that releases a segment borrow when dropped.
SegmentBorrowRegistry
Instruction-scoped segment borrow registry.
SegmentDescriptor
A single segment descriptor.
SegmentEntry
A segment entry in the registry.
SegmentLease
RAII lease on one registered entry in a SegmentBorrowRegistry.
SegmentRegistry
Read-only view over a segmented account’s registry.
SegmentRegistryMut
Mutable view over a segmented account’s registry.
SegmentSlice
Type-safe immutable slice over a segment’s elements.
SegmentSliceMut
Type-safe mutable slice over a segment’s elements.
SegmentTable
Read-only segment table.
SegmentTableMut
Mutable segment table.
StaticSegment
A compile-time constant segment descriptor.
TypedSegment
Compile-time typed segment descriptor: T is the overlay type, OFFSET is the absolute byte offset from the start of account data. Zero-sized.

Enums§

AccessKind
Read or write access intent for a segment borrow.
SegmentRole
Segment role classification.

Constants§

MAX_REGISTRY_SEGMENTS
Maximum segments in a registry.
MAX_SEGMENTS
Maximum number of segments per account.
REGISTRY_HEADER_SIZE
Size of the segment registry header.
REGISTRY_OFFSET
Offset where the registry header starts (after AccountHeader).
SEGMENT_DESC_SIZE
Size of one segment descriptor in bytes.
SEGMENT_ENTRY_SIZE
Size of one segment entry in bytes.
SEG_FLAG_DYNAMIC
SEG_FLAG_FROZEN
SEG_FLAG_LOCKED
Flags for segment entries.
SEG_ROLE_AUDIT
SEG_ROLE_CACHE
SEG_ROLE_CORE
Segment role flags – convenience constants for SegmentEntry::new().
SEG_ROLE_EXTENSION
SEG_ROLE_INDEX
SEG_ROLE_JOURNAL
SEG_ROLE_SHARD

Traits§

SegmentMap
Compile-time segment layout for a zero-copy struct.

Functions§

assert_segment_field_alignment
Compile-time assertion that a type’s SegmentMap and FieldMap are isomorphic: same count, same names, same offsets, same sizes.
segment_id
Compute a segment ID from a name (const FNV-1a hash, truncated to 4 bytes).

Type Aliases§

SegmentId
A 4-byte segment identifier, computed from a name at compile time.