[go: up one dir, main page]

ratatui

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§

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

Structs§

  • A buffer that maps to the desired content of the terminal after the draw call
  • A Backend implementation that uses Crossterm to render to the terminal.
  • A consistent view into the terminal state for rendering a single frame.
  • A layout is a set of constraints that can be applied to a given area to split it into smaller ones.
  • A line of text, consisting of one or more Spans.
  • A wrapper around a string that is masked when displayed.
  • Modifier changes the way a piece of text is displayed.
  • Position in the terminal
  • A Rectangular area.
  • A simple size struct
  • Represents a part of a line that is contiguous and where all characters share the same style.
  • Style lets you control the main characteristics of the displayed elements.
  • 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.
  • A Backend implementation that uses Termwiz to render to the terminal.
  • A string split over one or more lines.

Enums§

Traits§

  • 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.
  • 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.
  • 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.
  • A trait for converting types from Ratatui to Termwiz.
  • A StatefulWidget is a widget that can take advantage of some local state to remember things between two draw calls.
  • An extension trait for styling objects.
  • A Widget is a type that can be drawn on a Buffer in a given Rect.