ZXFoundation™ 26h2
Loading...
Searching...
No Matches
typestate.cxxm File Reference

Typestate carrier — compile-time lifecycle enforcement. More...

import std;
import zxfoundation.base.types;
Include dependency graph for typestate.cxxm:

Data Structures

class  zxfoundation::base::typestate< State >
 Zero-overhead typestate carrier. More...

Concepts

concept  zxfoundation::base::in_state
 Concept: T is in exactly state S.
concept  zxfoundation::base::state_at_least
 Concept: T is in state S or later.

Enumerations

enum class  zxfoundation::base::lifecycle_state : u8 {
  embryo = 0 , sealed = 1 , active = 2 , suspended = 3 ,
  dying = 4 , destroyed = 5
}
 Unified lifecycle states for ALL typestate-tracked resources. More...

Functions

template<lifecycle_state Query, lifecycle_state Actual>
constexpr auto zxfoundation::base::is_state (const typestate< Actual > &) noexcept -> bool
 Compile-time query: is this typestate-carrying type in state S?
constexpr auto zxfoundation::base::lifecycle_state_name (lifecycle_state s) noexcept -> std::string_view
 Return the ASCII name of a lifecycle_state value.

Variables

constexpr lifecycle_state zxfoundation::base::lifecycle_fresh = lifecycle_state::embryo
 Backward-compatible aliases for subsystems still using the old naming convention during migration.
constexpr lifecycle_state zxfoundation::base::lifecycle_ready = lifecycle_state::active

Detailed Description

Typestate carrier — compile-time lifecycle enforcement.

SPDX-License-Identifier: Apache-2.0

Enumeration Type Documentation

◆ lifecycle_state

enum class zxfoundation::base::lifecycle_state : u8
exportstrong

Unified lifecycle states for ALL typestate-tracked resources.

Every SCOMS-managed object, every folio, and every slab cache uses exactly these states. No subsystem may define its own.

Enumerator
embryo 

Allocated, fields being populated. Not usable yet.

sealed 

Resources bound (storage key, ASCE), not yet active.

active 

Fully initialized, accepting operations.

suspended 

Temporarily inactive (blocked, quiesced).

dying 

Teardown in progress. No new operations.

destroyed 

Fully torn down, awaiting reclamation.

Variable Documentation

◆ lifecycle_fresh

lifecycle_state zxfoundation::base::lifecycle_fresh = lifecycle_state::embryo
inlineconstexprexport

Backward-compatible aliases for subsystems still using the old naming convention during migration.

These will be removed once all subsystems are migrated. DO NOT use in new code.