flywheel/lib.rs
1//! # Flywheel
2//!
3//! A zero-flicker terminal compositor for Agentic CLIs.
4//!
5//! Flywheel is a purpose-built TUI engine designed for high-frequency token streaming
6//! (100+ tokens/s) without flickering, blocking, or latency.
7//!
8//! ## Core Concepts
9//!
10//! - **Double-buffered rendering**: Current and Next buffers with minimal diff
11//! - **Dirty rectangles**: Only re-render changed regions
12//! - **Actor model**: Isolated threads for input, rendering, and agent logic
13//! - **Optimistic append**: Fast path for streaming text that bypasses diffing
14//!
15//! ## Example
16//!
17//! ```rust,ignore
18//! use flywheel::{Buffer, Cell, Rect};
19//!
20//! // Create a buffer for a 80x24 terminal
21//! let mut buffer = Buffer::new(80, 24);
22//!
23//! // Write a cell
24//! buffer.set(0, 0, Cell::new('H'));
25//! ```
26
27#![warn(missing_docs)]
28#![warn(clippy::pedantic)]
29#![warn(clippy::nursery)]
30#![allow(clippy::module_name_repetitions)]
31#![allow(clippy::must_use_candidate)]
32#![allow(clippy::similar_names)]
33
34pub mod buffer;
35pub mod layout;
36pub mod terminal;
37pub mod actor;
38pub mod widget;
39
40// FFI module has intentional unsafe code and no_mangle exports
41#[allow(unsafe_code)]
42#[allow(clippy::missing_safety_doc)]
43pub mod ffi;
44
45// Re-exports for convenience
46pub use buffer::{Buffer, Cell, CellFlags, Modifiers, Rgb, RopeBuffer, ChunkedLine, RopeMemoryStats};
47pub use layout::{Layout, Rect, Region, RegionId};
48pub use actor::{Engine, EngineConfig, InputEvent, KeyCode, KeyModifiers, RenderCommand, AgentEvent, TickerActor, Tick};
49pub use widget::{
50 Widget, StreamWidget, StreamConfig, AppendResult, ScrollBuffer,
51 TextInput, TextInputConfig,
52 StatusBar, StatusBarConfig,
53 ProgressBar, ProgressBarConfig, ProgressStyle,
54};
55