[go: up one dir, main page]

Module prelude

Source
Expand description

A prelude for conveniently writing applications using this library.

The prelude module is no longer used universally in Ratatui, as it can make it harder to distinguish between library and non-library types, especially when viewing source code outside of an IDE (such as on GitHub or in a git diff). For more details and user feedback, see Issue #1150. However, the prelude is still available for backward compatibility and for those who prefer to use it.

§Examples

use ratatui::prelude::*;

Aside from the main types that are used in the library, this prelude also re-exports several modules to make it easy to qualify types that would otherwise collide. E.g.:

use ratatui::{prelude::*, widgets::*};

#[derive(Debug, Default, PartialEq, Eq)]
struct Line;

assert_eq!(Line::default(), Line);
assert_eq!(text::Line::default(), ratatui::text::Line::from(vec![]));

Modules§

backend
This module provides the backend implementations for different terminal libraries.
buffer
A module for the Buffer and Cell types.
layout
Provides types and traits for working with layout and positioning in the terminal.
style
style contains the primitives used to control how your user interface will look.
symbols
Symbols and markers for drawing various widgets.
text
Primitives for styled text.

Structs§

Buffer
A buffer that maps to the desired content of the terminal after the draw call
CrosstermBackendcrossterm
A Backend implementation that uses Crossterm to render to the terminal.
Frame
A consistent view into the terminal state for rendering a single frame.
Layout
A layout is a set of constraints that can be applied to a given area to split it into smaller ones.
Line
A line of text, consisting of one or more Spans.
Margin
Masked
A wrapper around a string that is masked when displayed.
Modifier
Modifier changes the way a piece of text is displayed.
Position
Position in the terminal
Rect
A Rectangular area.
Size
A simple size struct
Span
Represents a part of a line that is contiguous and where all characters share the same style.
Style
Style lets you control the main characteristics of the displayed elements.
Terminal
An interface to interact and draw Frames on the user’s terminal.
TermionBackendNon-Windows and termion
A Backend implementation that uses Termion to render to the terminal.
TermwizBackendtermwiz
A Backend implementation that uses Termwiz to render to the terminal.
Text
A string split over one or more lines.

Enums§

Alignment
Color
ANSI Color
Constraint
A constraint that defines the size of a layout element.
Direction

Traits§

Backend
The Backend trait provides an abstraction over different terminal libraries. It defines the methods required to draw content, manipulate the cursor, and clear the terminal screen.
BlockExt
An extension trait for Block that provides some convenience methods.
FromCrosstermcrossterm
A trait for converting a Crossterm type to a Ratatui type.
FromTermionNon-Windows and termion
A trait for converting a Termion type to a Ratatui type.
FromTermwiztermwiz
A trait for converting types from Termwiz to Ratatui.
IntoCrosstermcrossterm
A trait for converting a Ratatui type to a Crossterm type.
IntoTermionNon-Windows and termion
A trait for converting a Ratatui type to a Termion type.
IntoTermwiztermwiz
A trait for converting types from Ratatui to Termwiz.
StatefulWidget
A StatefulWidget is a widget that can take advantage of some local state to remember things between two draw calls.
Stylize
An extension trait for styling objects.
Widget
A Widget is a type that can be drawn on a Buffer in a given Rect.