Skip to main content

Crate cotis

Crate cotis 

Source
Expand description

§Cotis

Cotis is the core of a modular and expandable Rust library for building native user interfaces.

The crate is intentionally split into small pieces that can be swapped or extended:

  • layout interfaces and frame-building traits in layout
  • renderer interfaces and drawing traits in renders
  • conversion between layout output and renderer commands in pipes
  • application orchestration in cotis_app
  • element construction helpers in element_configuring
  • optional launch hooks and utilities in launch and utils

In other words, layout and renders define the integration traits that concrete layout and renderer crates implement to plug into Cotis.

A frame is typically computed in this order:

  1. A layout manager prepares for a frame.
  2. UI code builds the element tree through the configurator API.
  3. The layout manager produces layout output items.
  4. A pipe transforms those items into renderer commands.
  5. A renderer draws the command stream.

§Quick start

The common entry point is cotis_app::CotisApp, which connects a layout manager, renderer, and a pipes::LayoutRenderPipe. When layout output already matches renderer commands, pass [()] as the identity pipe (see pipes).

use cotis::cotis_app::{CotisApp, RenderApp};

let mut app = CotisApp::new(renderer, manager, ());
app.compute_frame(|root| {
    root.new_element().set_config(config);
});

Use cotis_app::AsyncRenderApp when your renderer performs async drawing.

Modules§

cotis_app
Application orchestration and frame computation entry points.
element_configuring
Element configuration primitives framework used while building UI trees.
launch
Launch hooks for platform-controlled startup and cotis-macros entry attributes. Launch hooks for environments where the application entry point is not under the interface developer’s control.
layout
Layout-side traits for frame construction, element configuration types, and layout output. Layout-side traits for building UI frames and producing per-frame output.
pipes
Pipes that transform layout output into renderer command streams. Conversion between layout output and renderer command streams.
renders
Renderer-side traits for synchronous and asynchronous frame drawing.
utils
Shared utility types (ownership wrappers, element identifiers, serialization helpers).