Skip to main content

cirious_codex_term/
lib.rs

1//! # Cirious Codex Term
2//!
3//! A high-performance, zero-allocation terminal styling and manipulation library
4//! designed as the foundational bedrock for the Cirious ecosystem.
5//!
6//! This crate provides an intuitive and elegant API for ANSI terminal colors,
7//! text styles, cursor movement, and screen clearing.
8//!
9//! ## Quick Start
10//!
11//! Simply import the `StyleExt` trait to seamlessly style any type that
12//! implements `std::fmt::Display`.
13//!
14//! ```rust
15//! use cirious_codex_term::StyleExt;
16//!
17//! // Style strings natively
18//! println!("{}", "Warning: High memory usage!".yellow().bold().blink());
19//!
20//! // Style any type seamlessly
21//! let age = 25;
22//! println!("You are {} years old.", age.green().underline());
23//! ```
24
25// Enables docs.rs features to show tags like "Only on Windows"
26#![cfg_attr(docsrs, feature(doc_cfg))]
27// Ensures all public items are documented (Essential for crates.io)
28#![warn(missing_docs)]
29// Prevents accidental unsafe code in the entire crate
30#![deny(unsafe_code)]
31
32/// ANSI control structures (Colors, Styles, Cursor, and Screen).
33pub mod control;
34
35/// Terminal lifecycle and environment utilities.
36pub mod prompt;
37
38/// Asynchronous terminal event handling (Keyboard, Mouse).
39pub mod event;
40
41// -----------------------------------------------------------------------------
42// PUBLIC API EXPORTS
43// -----------------------------------------------------------------------------
44
45// Styling & Control
46pub use control::{Color, Cursor, Screen, Style, StyleExt, StyledText};
47
48// Events
49pub use event::{poll, read, Event, KeyCode, KeyEvent};
50
51// Terminal Lifecycle
52pub use prompt::{init_term, RawModeGuard, TerminalSize};
53
54// Windows-specific utilities
55#[cfg(windows)]
56pub use prompt::enable_ansi_support;