Skip to main content

Module log_ring

Module log_ring 

Source
Expand description

Bounded circular buffer for log storage.

LogRing provides memory-efficient storage for log lines that evicts oldest entries when full. It supports absolute indexing across the entire history (even for evicted items) and optional overflow file persistence.

§Example

use ftui_widgets::LogRing;

let mut ring = LogRing::new(3);
ring.push("line 1");
ring.push("line 2");
ring.push("line 3");
ring.push("line 4"); // evicts "line 1"

assert_eq!(ring.len(), 3);
assert_eq!(ring.total_count(), 4);
assert_eq!(ring.get(3), Some(&"line 4"));
assert_eq!(ring.get(0), None); // evicted

Structs§

LogRing
Circular buffer for log storage with FIFO eviction.