pub struct TransitionHistory<S: Clone> { /* private fields */ }Expand description
Fixed-capacity ring buffer of screen transitions.
When full, the oldest entry is evicted on each new record().
§Example
use ftui_runtime::tick_strategy::TransitionHistory;
let mut history = TransitionHistory::with_capacity(100);
history.record("Dashboard".to_string(), "Messages".to_string(), 42);
assert_eq!(history.len(), 1);Implementations§
Source§impl<S: Clone> TransitionHistory<S>
impl<S: Clone> TransitionHistory<S>
Sourcepub fn with_capacity(capacity: usize) -> Self
pub fn with_capacity(capacity: usize) -> Self
Create a history buffer with the given capacity.
A capacity of 0 is clamped to 1.
Sourcepub fn record(&mut self, from: S, to: S, tick_count: u64)
pub fn record(&mut self, from: S, to: S, tick_count: u64)
Record a new screen transition.
If the buffer is at capacity, the oldest entry is evicted.
Sourcepub fn recent(&self, n: usize) -> Vec<&TransitionEntry<S>>
pub fn recent(&self, n: usize) -> Vec<&TransitionEntry<S>>
Return the most recent n transitions (or fewer if less are stored).
Entries are ordered oldest-first.
Trait Implementations§
Auto Trait Implementations§
impl<S> Forget for TransitionHistory<S>
impl<S> Freeze for TransitionHistory<S>
impl<S> Move for TransitionHistory<S>
impl<S> RefUnwindSafe for TransitionHistory<S>
impl<S> Send for TransitionHistory<S>
impl<S> Sync for TransitionHistory<S>
impl<S> Unpin for TransitionHistory<S>
impl<S> UnsafeUnpin for TransitionHistory<S>
impl<S> UnwindSafe for TransitionHistory<S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more