Expand description
Record, replay, and isolate Cotis modules for debugging layout, UI declaration, and render pipelines.
Cotis builds native UIs through a modular pipeline: UI code declares an element tree, a layout manager computes geometry, and a renderer draws the result. Running the full app stack for every investigation is slow. This crate captures intermediate artifacts as JSON so you can replay individual stages in isolation.
§Three-stage debug pipeline
Stage 1 — Record (live app + debug wrappers)
UI uses DebugInitialConfiguredParentElement / DebugOpenElement / ...
→ LeafedInterfaceDeclaration → interface_*.json
LayoutModuleCapture wraps a LayoutManager
→ store_computed_layout → elements_*.json
Stage 2 — Replay UI declaration (layout only, normal app)
LeafedInterfaceDeclaration::load_from(...)
→ implements UiFn → rebuilds element tree without debug wrappers
Stage 3 — Render-only (skip layout entirely)
load_computed_layout(...)
→ CotisLayoutToRenderListPipeForGenerics::transform
→ renderer.draw_frame(...)See the gradients_example_solid, gradients_example_solid_replay, and
gradients_example_solid_render_only examples for a complete walkthrough.
§Serialization requirements
This crate always depends on cotis with the serialization feature. Consumers must
also enable serialization on the types they capture:
| Stage | Serialized data | Required features / bounds |
|---|---|---|
| 1 — Record UI | ConfigType, leaf configs | cotis/serialization; leaf types: Serialize |
| 1 — Record layout | Vec<ElementsOutput> | cotis-layout/serialization |
| 2 — Replay UI | ConfigType + LeafConfigList | ConfigType: DeserializeOwned |
| 3 — Render-only | e.g. RenderCommandOutput from cotis-layout | cotis-layout/serialization |
ElementsOutput must implement Serialize + DeserializeOwned for file I/O helpers
in layout_module_debugger.
§Quick start
Record pass:
use cotis_modules_debug::declaration_debugger::debug_element_configuring::DebugInitialConfiguredParentElement;
use cotis_modules_debug::layout_module_debugger::capture::LayoutModuleCapture;
use cotis_modules_debug::layout_module_debugger::store_computed_layout;
use cotis_modules_debug::serialize_targets::{LeafedInterfaceDeclaration, SerializedInterfaceDeclaration};
use cotis_modules_debug::serialize_targets::leaf_serialization::{LeafConfigList, LeafConfigListNil};
type Leafs = LeafConfigList<TextElementConfig<'static>, LeafConfigListNil>;
let mut decl = LeafedInterfaceDeclaration::new(SerializedInterfaceDeclaration::new(), Leafs::new());
// Wrap layout root: DebugInitialConfiguredParentElement::new(layout, &mut decl)
// ... build UI ...
decl.store_in(path)?;
store_computed_layout(app.layout_manager().output(), path)?;Replay pass (stage 2):
let decl = LeafedInterfaceDeclaration::load_from(path, Leafs::new())?;
// compute_frame(&mut app, &decl) — decl implements UiFnRender-only (stage 3):
use cotis_layout::layout_struct::RenderCommandOutput;
use cotis_pipes::cotis_layout_pipes::CotisLayoutToRenderListPipeForGenerics;
let output = load_computed_layout::<RenderCommandOutput<ExampleConfig>>(path)?;
let cmds: Vec<_> = pipe.transform(output.into_iter()).collect();
renderer.draw_frame(cmds.into_iter());§Module map
declaration_debugger— debug wrappers aroundcotis::element_configuringthat record everyopen/configure/closeinto aLeafedInterfaceDeclaration.serialize_targets— instruction-stream types, JSON persistence, and leaf-config type-list machinery for deserialization.layout_module_debugger— capture layout output to JSON; replay declarations through a layout manager in isolation.render_module_debugger— replay precomputed render commands through a renderer when layout-manager init side effects are needed.
Modules§
- declaration_
debugger - Debug wrappers that record UI declaration operations while building a live interface.
- layout_
module_ debugger - Capture and replay layout-module output for debugging.
- render_
module_ debugger - Renderer replay wrapper for re-drawing saved render command streams.
- serialize_
targets - Serializable UI declaration instruction streams and leaf-config type lists.