pub struct PaneInteractionTimeline {
pub baseline: Option<PaneTreeSnapshot>,
pub entries: Vec<PaneInteractionTimelineEntry>,
pub cursor: usize,
}Expand description
Persistent interaction timeline with undo/redo cursor.
Fields§
§baseline: Option<PaneTreeSnapshot>Baseline tree before first recorded mutation.
entries: Vec<PaneInteractionTimelineEntry>Full operation history in deterministic order.
cursor: usizeNumber of entries currently applied (<= entries.len()).
Implementations§
Source§impl PaneInteractionTimeline
impl PaneInteractionTimeline
Sourcepub fn with_baseline(tree: &PaneTree) -> Self
pub fn with_baseline(tree: &PaneTree) -> Self
Construct a timeline with an explicit baseline snapshot.
Sourcepub const fn applied_len(&self) -> usize
pub const fn applied_len(&self) -> usize
Number of currently-applied entries.
Sourcepub fn apply_and_record(
&mut self,
tree: &mut PaneTree,
sequence: u64,
operation_id: u64,
operation: PaneOperation,
) -> Result<PaneOperationOutcome, PaneOperationError>
pub fn apply_and_record( &mut self, tree: &mut PaneTree, sequence: u64, operation_id: u64, operation: PaneOperation, ) -> Result<PaneOperationOutcome, PaneOperationError>
Append one operation by applying it to the provided tree.
If the cursor is behind the head (after undo), redo entries are dropped before appending the new branch.
Sourcepub fn undo(
&mut self,
tree: &mut PaneTree,
) -> Result<bool, PaneInteractionTimelineError>
pub fn undo( &mut self, tree: &mut PaneTree, ) -> Result<bool, PaneInteractionTimelineError>
Undo the last applied entry by deterministic rebuild from baseline.
Sourcepub fn redo(
&mut self,
tree: &mut PaneTree,
) -> Result<bool, PaneInteractionTimelineError>
pub fn redo( &mut self, tree: &mut PaneTree, ) -> Result<bool, PaneInteractionTimelineError>
Redo one entry by deterministic rebuild from baseline.
Sourcepub fn replay(&self) -> Result<PaneTree, PaneInteractionTimelineError>
pub fn replay(&self) -> Result<PaneTree, PaneInteractionTimelineError>
Rebuild a new tree from baseline and currently-applied entries.
Trait Implementations§
Source§impl Clone for PaneInteractionTimeline
impl Clone for PaneInteractionTimeline
Source§fn clone(&self) -> PaneInteractionTimeline
fn clone(&self) -> PaneInteractionTimeline
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 moreSource§impl Debug for PaneInteractionTimeline
impl Debug for PaneInteractionTimeline
Source§impl Default for PaneInteractionTimeline
impl Default for PaneInteractionTimeline
Source§fn default() -> PaneInteractionTimeline
fn default() -> PaneInteractionTimeline
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for PaneInteractionTimeline
impl<'de> Deserialize<'de> for PaneInteractionTimeline
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for PaneInteractionTimeline
impl PartialEq for PaneInteractionTimeline
Source§impl Serialize for PaneInteractionTimeline
impl Serialize for PaneInteractionTimeline
impl Eq for PaneInteractionTimeline
impl StructuralPartialEq for PaneInteractionTimeline
Auto Trait Implementations§
impl Freeze for PaneInteractionTimeline
impl RefUnwindSafe for PaneInteractionTimeline
impl Send for PaneInteractionTimeline
impl Sync for PaneInteractionTimeline
impl Unpin for PaneInteractionTimeline
impl UnsafeUnpin for PaneInteractionTimeline
impl UnwindSafe for PaneInteractionTimeline
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