cotis-debugging
cotis-modules-debug records, replays, and isolates Cotis modules for debugging layout, UI declaration, and render pipelines. It captures intermediate artifacts as JSON so you can investigate individual stages without running the full app stack every time.
Status: Early
0.1.0-alpharelease. APIs are still evolving alongside the core Cotis crates.
This repository contains debugging and serialization tooling only. It does not open a window or define layout rules by itself. For a runnable desktop app, combine it with core Cotis crates, a layout engine, a pipe, and a renderer backend from the ecosystem below.
Architecture
Cotis builds native UIs through a modular pipeline. This crate adds a three-stage debug workflow on top:
flowchart LR
subgraph stage1 [Stage1_Record]
DbgUI[DebugConfiguredParentElement]
DbgLayout[LayoutModuleCapture]
DbgUI --> interfaceJson[interface_*.json]
DbgLayout --> elementsJson[elements_*.json]
end
subgraph stage2 [Stage2_ReplayUI]
LoadUI[LeafedInterfaceDeclaration::load_from]
LoadUI --> LayoutMgr[CotisLayoutManager]
end
subgraph stage3 [Stage3_RenderOnly]
LoadLayout[load_computed_layout]
LoadLayout --> Pipe[cotis-pipes]
Pipe --> Renderer[cotis-raylib]
end
stage1 --> stage2
stage1 --> stage3
- Record — wrap UI declaration and layout manager with debug helpers; write
interface_*.jsonandelements_*.json. - Replay UI — load the stored declaration and rebuild the element tree through a normal layout manager.
- Render-only — load precomputed layout output, pipe it to render commands, and draw without running layout.
Installation
Add the debugging crate and required core dependencies to your Cargo.toml:
= "0.1.0-alpha"
= { = "0.1.0-alpha", = ["serialization"] }
Stages that capture or replay layout output also need cotis-layout with the serialization feature enabled. See Serialization requirements.
Quick start
Clone this repository and run the three-stage example pipeline from the repository root:
# Stage 1 — record (writes JSON next to the examples)
# Stage 2 — replay stored UI declaration
# Stage 3 — render precomputed layout (skip layout manager)
Stages 2 and 3 require JSON files produced by stage 1. Generated examples/*.json files are gitignored.
The raylib crate links against native raylib libraries. On Linux you may need development packages for X11, OpenGL, and audio (for example libx11-dev, libxrandr-dev, libxi-dev, libgl1-mesa-dev, libasound2-dev).
Typical record pass
use DebugInitialConfiguredParentElement;
use store_computed_layout;
use ;
use ;
type Leafs = ;
let mut decl = new;
// Wrap layout root with DebugInitialConfiguredParentElement and build UI ...
decl.store_in?;
store_computed_layout?;
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 |
cotis-layout/serialization |
Ecosystem
Cotis is split across several repositories. This repo provides debugging and replay tooling; sibling repos provide core traits, layout, pipes, and render backends.
| Repository | Role |
|---|---|
cotis |
Core traits and CotisApp orchestration |
cotis-layout |
Flexbox-style layout engine (CotisLayoutManager) |
cotis-pipes |
Layout output to render commands (CotisLayoutToRenderListPipeForGenerics) |
cotis-wgpu |
Desktop renderer (wgpu + winit + glyphon) |
cotis-raylib |
Desktop renderer (raylib) |
| cotis-debugging (this repo) | Record, replay, and isolate pipeline stages |
cotis-renderer-template |
Scaffold for authoring a custom render backend |
cotis-cli |
Plugin host for installable build and run routines |
Examples
| Example | Stage | Command |
|---|---|---|
gradients_example_solid |
1 — Record | cargo run -p cotis-modules-debug --example gradients_example_solid |
gradients_example_solid_replay |
2 — Replay UI | cargo run -p cotis-modules-debug --example gradients_example_solid_replay |
gradients_example_solid_render_only |
3 — Render-only | cargo run -p cotis-modules-debug --example gradients_example_solid_render_only |
Examples resolve asset paths from the crate manifest directory, so they work regardless of the current working directory. The bundled Roboto font is licensed under the Apache License 2.0 (Google Fonts).
Documentation
- API reference:
cargo doc -p cotis-modules-debug --open - Published docs: cotis-modules-debug
- Core crate docs: cotis, cotis-defaults, cotis-utils