Crate term_render

Crate term_render 

Source

Re-exports§

pub use render::Colorize;

Modules§

event_handler
Handling terminal events (key presses, mouse events, etc.) This module provides functionality to parse and manage terminal input events. The actual polling of events is handled externally. Event handling utilities for terminal input parsing.
render
Rendering to the terminal (drawing characters, managing screen buffer, etc.) This module is often referred to as the backend rendering, or original rendering ( as it was the original component before the higher level abstractions were added). Many of the nuances carried over to the higher level abstractions came from this module.
widget
Widgets and scene management (UI components, layout, etc.) This module provides the building blocks for creating and managing UI components. It includes a scene graph to manage the hierarchy and relationships between widgets.
widget_impls
Predefined widget implementations and builders (convenience functions for common widgets) This module provides ready-to-use widget implementations and builders for common UI components. It simplifies the process of creating and configuring widgets by providing default behaviors and properties.

Macros§

color
Expands to a call to the Colorize trait, reducing boilerplate. If a single value is provided, it converts to a call to Colorize::colorize with the provided value. If none, or multiple values are provided, it converts to a call to Colorize::colorizes with a vector of the provided values. This macro can be used with any type that implements the Colorize trait, including:
send_sync
Expands the provided value into an Arc<RwLock<T>>. This is a shorthand macro to avoid writing the full expression every time (i.e. std::sync::Arc::new(parking_lot::RwLock::new(value)) ).

Structs§

App
The main application struct that combines rendering and event handling. This will handle the background work, leaving the user to focus on the application logic. The generic parameter C represents the application data type, which can be any type defined by the user. This data is passed to the callback function every frame, allowing the user to maintain and update state. The application data is stored separately from the App instance, but is linked from the instance. This allows for a clear separation of concerns.
AppErr
Represents an internal error within the App struct/workings of lib.rs. This is used to propagate errors from background tasks (rendering and event handling) back to the main application loop, allowing for graceful shutdown and error reporting. This error type is distinct from user-defined errors that may arise from the callback function.

Type Aliases§

SendSync
A type alias for a thread-safe, shared, mutable reference to a value of type T. This uses Arc for shared ownership and RwLock for interior mutability.’ The RwLock type comes from the parking_lot crate, which is a more efficient implementation than the standard library’s std::sync::RwLock. The Arc type used is still from the standard library. This is used extensively throughout the application to manage shared state safely across threads. This is also paired with the send_sync! macro to simplify the creation of such types.