Expand description
The full contract lane, mirroring TS contract.ts: every public free function and type.
Structs§
- Debug
Options - Options for
enable_debug(TSDebugOptions).subsystemsselects the registered subsystems to switch on (all of them when omitted);levelis the session’s global level (defaultLogLevel::Debug);channelsraises extra channels;sinkoverrides the installed dev sink (default a level-prefixed text console sink). - Debug
State - The debug umbrella’s state (D5): the source module’s subsystem registry, active session and
frame counter, held by the caller instead of in module globals. Registration order is kept, as
the source
Mapkeeps insertion order. - Debug
Subsystem Hooks - The wiring a subsystem contributes to a debug session (TS
DebugSubsystemHooks): the log channels raised while it is enabled, and its guard enabler and disabler. Every field is optional.disable_guardsmust be safe after a missing or partially completedenable_guards, so a failed enable can be unwound.
Functions§
- begin_
debug_ span - Opens a named timing span only while a debug session is active (TS
beginDebugSpan): a runningLogTimerto hand toend_debug_span, orNonewhen debug is disabled (nothing is allocated). - create_
debug_ state - Creates an empty debug state: no registered subsystems and no active session (D5: the source module’s globals, owned by the caller).
- disable_
debug - Returns Flight to the zero-debug baseline (TS
disableDebug): runs the disable-guards binding of every subsystem the session switched on, removes the sink it installed, and restores the log levels it raised. A no-op when debug is not enabled. - enable_
debug - Enables a debug session (TS
enableDebug). It installsoptions.sink, raises the global level (defaultLogLevel::Debug) and the channels of the selected subsystems plusoptions.channels, then runs each selected subsystem’s guard enabler in order.options.subsystemsselects registered subsystems by name (unregistered names are skipped); omitted, every registered subsystem is switched on. A second call while enabled is a no-op. - enable_
flight_ diagnostics - Enables a debug session with the default options, then the generic render guards for one render
state (TS
enableFlightDiagnostics), reporting through the same caller-owned log state. - end_
debug_ span - Closes a span opened by
begin_debug_span(TSendDebugSpan), emitting its elapsed-time Debug entry and returning the elapsed milliseconds. ANonetimer (debug was disabled when the span opened) is a no-op returning -1, the “not measured” sentinel. - initialize_
debug_ state - Resets a debug state to the source module’s initial values (the construction initializer of
create_debug_state). - is_
debug_ enabled - Whether a debug session is in effect (TS
isDebugEnabled). - mark_
debug_ frame - Emits a frame-boundary marker while a debug session is active (TS
markDebugFrame): a Debug entry{ frame: label }, or, unlabeled, the next value of the state’s ascending frame counter, which a new session does not reset. A no-op, with no counter advance, when debug is disabled. - measure_
debug_ span - Times a synchronous function as one span while a debug session is active (TS
measureDebugSpan) and returns its result. With debug disabled the function still runs and only the timing is skipped. The span is closed, and its entry emitted, even when the function panics (the source’s throw), and the panic then resumes.clockis read once when the span opens and once when it closes. - register_
debug_ subsystem - Registers a subsystem’s channels and guard bindings under
name(TSregisterDebugSubsystem). Last write wins, and a replaced name keeps its registration position, as the sourceMapdoes. - unregister_
debug_ subsystem - Removes a subsystem registration (TS
unregisterDebugSubsystem): false when nothing was registered undername. An already active session is not affected.
Type Aliases§
- Debug
Guard Binding - One subsystem guard binding (TS
() => void). - Debug
State Ref - Shared caller-owned debug state.
- Debug
Subsystem Name - The name of a diagnostic subsystem (TS
DebugSubsystemName): an open string union whose seeded built-ins areanimation,audio,input,loader,connectivity,particles,renderandtext. Custom subsystems use a vendor prefix (acme.physics).