pub struct History { /* private fields */ }Expand description
Change history log.
Records all changes made to a buffer in chronological order.
Unlike UndoTree, this is a simple linear log without branching.
§Use Cases
- Debugging: See what changes were made and when
- Auditing: Track modification history
- Collaboration: Synchronize changes between editors
§Memory Management
The history has a configurable maximum number of entries. When exceeded, the oldest entries are removed.
Implementations§
Source§impl History
impl History
Sourcepub const DEFAULT_MAX_ENTRIES: usize = 10000
pub const DEFAULT_MAX_ENTRIES: usize = 10000
Default maximum number of entries.
Sourcepub fn with_max_entries(max_entries: usize) -> Self
pub fn with_max_entries(max_entries: usize) -> Self
Create a new history with custom maximum entries.
Sourcepub fn entries(&self) -> &[HistoryEntry]
pub fn entries(&self) -> &[HistoryEntry]
Get all entries in chronological order.
Sourcepub fn last(&self) -> Option<&HistoryEntry>
pub fn last(&self) -> Option<&HistoryEntry>
Get the most recent entry.
Sourcepub fn get(&self, index: usize) -> Option<&HistoryEntry>
pub fn get(&self, index: usize) -> Option<&HistoryEntry>
Get an entry by index.
Sourcepub const fn max_entries(&self) -> usize
pub const fn max_entries(&self) -> usize
Get the maximum entries limit.
Sourcepub fn set_max_entries(&mut self, max: usize)
pub fn set_max_entries(&mut self, max: usize)
Set the maximum entries limit.
Sourcepub const fn seq_counter(&self) -> u64
pub const fn seq_counter(&self) -> u64
Get the current sequential counter value.
Sourcepub fn since(&self, seq_num: u64) -> Vec<&HistoryEntry>
pub fn since(&self, seq_num: u64) -> Vec<&HistoryEntry>
Get entries since a given sequence number.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for History
impl RefUnwindSafe for History
impl Send for History
impl Sync for History
impl Unpin for History
impl UnsafeUnpin for History
impl UnwindSafe for History
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