pub struct UndoHistorySnapshot {
pub format_version: u32,
pub undo_stack: Vec<UndoHistoryStep>,
pub redo_stack: Vec<UndoHistoryStep>,
pub max_undo: usize,
pub clean_index: Option<usize>,
pub next_group_id: usize,
pub open_group_id: Option<usize>,
}Expand description
A persistable snapshot of the undo/redo history for a single document.
This is intended for “hot exit” workflows: persist the editor text plus this snapshot, then restore both on startup so undo/redo keeps working across restarts.
Notes:
- This snapshot does not include the current document text; callers are responsible for persisting/restoring the text separately.
- Restoring a snapshot into a different document text will produce undefined undo behavior.
Fields§
§format_version: u32Snapshot format version for forward compatibility.
undo_stack: Vec<UndoHistoryStep>Undo steps (oldest → newest).
redo_stack: Vec<UndoHistoryStep>Redo steps (oldest → newest).
max_undo: usizeConfigured maximum undo history depth.
clean_index: Option<usize>Clean point tracking in the linearized history (index into undo_stack + redo_stack).
next_group_id: usizeThe next group id to allocate.
open_group_id: Option<usize>Currently open coalescing group id, if any.
Trait Implementations§
Source§impl Clone for UndoHistorySnapshot
impl Clone for UndoHistorySnapshot
Source§fn clone(&self) -> UndoHistorySnapshot
fn clone(&self) -> UndoHistorySnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for UndoHistorySnapshot
impl Debug for UndoHistorySnapshot
impl Eq for UndoHistorySnapshot
Source§impl PartialEq for UndoHistorySnapshot
impl PartialEq for UndoHistorySnapshot
Source§fn eq(&self, other: &UndoHistorySnapshot) -> bool
fn eq(&self, other: &UndoHistorySnapshot) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for UndoHistorySnapshot
Auto Trait Implementations§
impl Freeze for UndoHistorySnapshot
impl RefUnwindSafe for UndoHistorySnapshot
impl Send for UndoHistorySnapshot
impl Sync for UndoHistorySnapshot
impl Unpin for UndoHistorySnapshot
impl UnsafeUnpin for UndoHistorySnapshot
impl UnwindSafe for UndoHistorySnapshot
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