Skip to main content

Crate hojicha_rendering

Crate hojicha_rendering 

Source
Expand description

High-performance rendering optimization for the Hojicha TUI framework

This crate provides differential rendering to minimize terminal updates by tracking and only redrawing changed regions of the UI.

§Features

  • Differential Rendering: Track dirty regions and only redraw what changed
  • Region Coalescing: Automatically merge overlapping dirty regions
  • Component Dependencies: Track component relationships for cascading updates
  • Checksum-based Change Detection: Detect actual content changes

§Example

use hojicha_rendering::DifferentialRenderer;
use ratatui::layout::Rect;

let mut renderer = DifferentialRenderer::new();

// Register UI components
renderer.register_component("header".to_string(), Rect::new(0, 0, 80, 3));
renderer.register_component("content".to_string(), Rect::new(0, 3, 80, 20));

// Mark a component as dirty when it changes
renderer.mark_component_dirty("content");

// Check if rendering is needed
if renderer.component_needs_render("content") {
    // Render the component
}

Re-exports§

pub use differential::next_version;
pub use differential::Checksum;
pub use differential::ComponentState;
pub use differential::DifferentialConfig;
pub use differential::DifferentialRenderer;
pub use differential::DirtyRegion;
pub use differential::Version;

Modules§

algorithms
Core algorithms for differential rendering.
differential
Differential rendering system for efficient UI updates
prelude
Prelude for convenient imports