API Reference¶
This page provides an overview of the Fast-Rich API. For detailed documentation of every type and function, see the docs.rs documentation.
Generate Local Documentation¶
Core Modules¶
console¶
The main output interface for Fast-Rich.
| Type | Description |
|---|---|
Console |
Primary output handler with color detection and styling |
style¶
Colors and text styling.
| Type | Description |
|---|---|
Style |
Text style with colors and attributes |
Color |
Color enum (Named, RGB, Ansi256) |
text¶
Rich text with spans and alignment.
| Type | Description |
|---|---|
Text |
Styled text with multiple spans |
Alignment |
Text alignment (Left, Center, Right) |
use fast_rich::text::{Text, Alignment};
let text = Text::plain("Hello").alignment(Alignment::Center);
table¶
Data tables with customizable borders.
| Type | Description |
|---|---|
Table |
Table with columns and rows |
Column |
Column configuration |
ColumnAlign |
Column alignment (Left, Center, Right) |
use fast_rich::{Table, Column, ColumnAlign};
let mut table = Table::new();
table.add_column("Name");
panel¶
Bordered panels for content organization.
| Type | Description |
|---|---|
Panel |
Content box with border and title |
BorderStyle |
Border style (Rounded, Square, Heavy, etc.) |
use fast_rich::{Panel, BorderStyle};
let panel = Panel::new(text).border_style(BorderStyle::Rounded);
progress¶
Progress bars and spinners.
| Type | Description |
|---|---|
Progress |
Multi-task progress manager |
ProgressBar |
Single progress bar |
Spinner |
Animated spinner |
Status |
Simple status indicator |
live¶
Flicker-free live updating display.
| Type | Description |
|---|---|
Live |
Auto-refreshing display manager |
layout¶
Screen splitting and layouts.
| Type | Description |
|---|---|
Layout |
Nestable screen layout |
tree¶
Hierarchical data visualization.
| Type | Description |
|---|---|
Tree |
Tree with root node |
TreeNode |
Child node for nesting |
GuideStyle |
Guide line style |
rule¶
Horizontal divider lines.
| Type | Description |
|---|---|
Rule |
Decorative horizontal line |
Optional Modules¶
These require feature flags.
syntax (requires syntax feature)¶
| Type | Description |
|---|---|
Syntax |
Syntax-highlighted code |
SyntaxTheme |
Color theme for highlighting |
markdown (requires markdown feature)¶
| Type | Description |
|---|---|
Markdown |
Markdown renderer |
log (requires logging feature)¶
| Type | Description |
|---|---|
RichLogger |
Log crate handler |
ConsoleLog |
Console-based logging |
traceback¶
| Type | Description |
|---|---|
Traceback |
Pretty error display |
TracebackConfig |
Traceback options |
install_panic_hook |
Function to install panic handler |
The Prelude¶
Import everything you need with the prelude:
The prelude includes:
- Console
- Style, Color
- Text, Alignment
- Table, Column, ColumnAlign
- Panel, BorderStyle
- Rule
- Tree, TreeNode, GuideStyle
- Progress, ProgressBar, Spinner, Status
- Columns
- inspect, InspectConfig
- ConsoleLog
- install_panic_hook
The Renderable Trait¶
All displayable types implement Renderable:
Use console.print_renderable(&item) to display any Renderable.
Custom types can implement Renderable to integrate with Fast-Rich output.