Expand description
debug_registry — opt-in registry of named data models for the Teksilo inspector.
Provides the infrastructure for the inspector’s Models tab: models register
themselves under a human-readable name, and the inspector calls snapshot to
obtain a live list of every registered model without keeping them alive past
their natural lifetime.
The registry is a thread-local Vec of Weak<dyn ModelDebug> entries.
Models opt in via the debug-only .debug_named("name") builder method on
crate::ListModel, crate::TreeModel, and crate::SelectionModel;
that method creates a strong Rc<dyn ModelDebug> adapter and stores it
inside the model’s own Rc<RefCell<Inner>>, while registering a Weak
clone here. When the last model handle is dropped the Weak becomes dead,
and the next call to snapshot prunes it automatically.
This entire module is compiled only when debug_assertions are enabled
and contributes zero overhead to release builds.
Traits§
- Model
Debug - Type-erased debug view of a data model. Implementors live in
teksilo-dataitself (ListModel,TreeModel, etc.); the inspector uses these methods to render the Data Models tab without needing to knowT.
Functions§
- register
- Register a model under a human-readable name. The name does not need to be unique across registrations — the inspector lists every entry — but uniqueness aids tracking.
- snapshot
- Snapshot every live registration. Drops dead
Weaks during the walk so the registry doesn’t grow unbounded as models churn.