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§
Source§impl<S: Clone + Clone> Clone for TransitionHistory<S>
impl<S: Clone + Clone> Clone for TransitionHistory<S>
Source§fn clone(&self) -> TransitionHistory<S>
fn clone(&self) -> TransitionHistory<S>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<S> Freeze for TransitionHistory<S>
impl<S> RefUnwindSafe for TransitionHistory<S>where
S: RefUnwindSafe,
impl<S> Send for TransitionHistory<S>where
S: Send,
impl<S> Sync for TransitionHistory<S>where
S: Sync,
impl<S> Unpin for TransitionHistory<S>where
S: Unpin,
impl<S> UnsafeUnpin for TransitionHistory<S>
impl<S> UnwindSafe for TransitionHistory<S>where
S: UnwindSafe,
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