ratatui_core/
lib.rs

1#![no_std]
2// show the feature flags in the generated documentation
3#![cfg_attr(docsrs, feature(doc_cfg))]
4#![cfg_attr(docsrs, feature(doc_auto_cfg))]
5#![doc(
6    html_logo_url = "https://raw.githubusercontent.com/ratatui/ratatui/main/assets/logo.png",
7    html_favicon_url = "https://raw.githubusercontent.com/ratatui/ratatui/main/assets/favicon.ico"
8)]
9//! **ratatui-core** is the core library of the [ratatui] project,
10//! providing the essential building blocks for creating rich terminal user interfaces in Rust.
11//!
12//! [ratatui]: https://github.com/ratatui/ratatui
13//!
14//! ## Why `ratatui-core`?
15//!
16//! The `ratatui-core` crate is split from the main [`ratatui`](https://crates.io/crates/ratatui) crate
17//! to offer better stability for widget library authors. Widget libraries should generally depend
18//! on `ratatui-core`, benefiting from a stable API and reducing the need for frequent updates.
19//!
20//! Applications, on the other hand, should depend on the main `ratatui` crate, which includes
21//! built-in widgets and additional features.
22//!
23//! # Installation
24//!
25//! Add `ratatui-core` to your `Cargo.toml`:
26//!
27//! ```shell
28//! cargo add ratatui-core
29//! ```
30//!
31//! # Crate Organization
32//!
33//! `ratatui-core` is part of the Ratatui workspace that was modularized in version 0.30.0 to
34//! improve compilation times, API stability, and dependency management. This crate provides the
35//! foundational types and traits that other crates in the workspace depend on.
36//!
37//! **When to use `ratatui-core`:**
38//!
39//! - Building widget libraries that implement [`Widget`] or [`StatefulWidget`]
40//! - Creating lightweight applications that don't need built-in widgets
41//! - You want minimal dependencies and faster compilation times
42//! - You need maximum API stability (core types change less frequently)
43//!
44//! **When to use the main [`ratatui`] crate:**
45//!
46//! - Building applications that use built-in widgets
47//! - You want convenience and don't mind slightly longer compilation times
48//! - You need backend implementations and terminal management utilities
49//!
50//! For detailed information about the workspace organization, see [ARCHITECTURE.md].
51//!
52//! [`ratatui`]: https://crates.io/crates/ratatui
53//! [`Widget`]: widgets::Widget
54//! [`StatefulWidget`]: widgets::StatefulWidget
55//! [ARCHITECTURE.md]: https://github.com/ratatui/ratatui/blob/main/ARCHITECTURE.md
56#![cfg_attr(feature = "document-features", doc = "\n## Features")]
57#![cfg_attr(feature = "document-features", doc = document_features::document_features!())]
58//!
59//! # Contributing
60//!
61//! We welcome contributions from the community! Please see our [CONTRIBUTING](../CONTRIBUTING.md)
62//! guide for more details on how to get involved.
63//!
64//! ## License
65//!
66//! This project is licensed under the MIT License. See the [LICENSE](../LICENSE) file for details.
67
68#![warn(clippy::std_instead_of_core)]
69#![warn(clippy::std_instead_of_alloc)]
70#![warn(clippy::alloc_instead_of_core)]
71
72extern crate alloc;
73#[cfg(feature = "std")]
74extern crate std;
75
76pub mod backend;
77pub mod buffer;
78pub mod layout;
79pub mod style;
80pub mod symbols;
81pub mod terminal;
82pub mod text;
83pub mod widgets;