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#![deny(unsafe_code)] // Core library denies unsafe - only FFI module may allow it
31#![allow(clippy::module_name_repetitions)]
32#![allow(clippy::must_use_candidate)]
33#![allow(clippy::similar_names)]
34
35pub mod buffer;
36pub mod layout;
37pub mod terminal;
38pub mod actor;
39pub mod widget;
40
41// FFI module has intentional unsafe code and no_mangle exports
42#[allow(unsafe_code)]
43#[allow(clippy::missing_safety_doc)]
44pub mod ffi;
45
46// Re-exports for convenience
47pub use buffer::{Buffer, Cell, CellFlags, Modifiers, Rgb, RopeBuffer, ChunkedLine, RopeMemoryStats};
48pub use layout::{Layout, Rect, Region, RegionId};
49pub use actor::{Engine, EngineConfig, InputEvent, KeyCode, KeyModifiers, RenderCommand, AgentEvent, TickerActor, Tick};
50pub use widget::{
51 Widget, StreamWidget, StreamConfig, AppendResult, ScrollBuffer,
52 TextInput, TextInputConfig,
53 StatusBar, StatusBarConfig,
54 ProgressBar, ProgressBarConfig, ProgressStyle,
55};
56