pub struct UndoRedoManager { /* private fields */ }Expand description
Manages undo/redo operations for a conversation
Implementations§
Source§impl UndoRedoManager
impl UndoRedoManager
Sourcepub fn with_memory_limit(max_memory_mb: usize) -> Self
pub fn with_memory_limit(max_memory_mb: usize) -> Self
Create a new undo/redo manager with custom memory limit
Sourcepub fn save_state(
&mut self,
items: Vec<ResponseItem>,
metadata: SnapshotMetadata,
) -> CodexResult<Uuid>
pub fn save_state( &mut self, items: Vec<ResponseItem>, metadata: SnapshotMetadata, ) -> CodexResult<Uuid>
Save the current conversation state
Sourcepub fn undo(&mut self) -> CodexResult<Option<ConversationSnapshot>>
pub fn undo(&mut self) -> CodexResult<Option<ConversationSnapshot>>
Undo the last operation
Sourcepub fn redo(&mut self) -> CodexResult<Option<ConversationSnapshot>>
pub fn redo(&mut self) -> CodexResult<Option<ConversationSnapshot>>
Redo the last undone operation
Sourcepub fn create_branch(
&mut self,
branch_name: String,
description: Option<String>,
items: Vec<ResponseItem>,
metadata: SnapshotMetadata,
) -> CodexResult<Uuid>
pub fn create_branch( &mut self, branch_name: String, description: Option<String>, items: Vec<ResponseItem>, metadata: SnapshotMetadata, ) -> CodexResult<Uuid>
Create a branch from the current state
Sourcepub fn switch_to_branch(
&mut self,
branch_id: Uuid,
) -> CodexResult<Option<ConversationSnapshot>>
pub fn switch_to_branch( &mut self, branch_id: Uuid, ) -> CodexResult<Option<ConversationSnapshot>>
Switch to a specific branch
Sourcepub fn get_branches(&self) -> Vec<(Uuid, BranchInfo)>
pub fn get_branches(&self) -> Vec<(Uuid, BranchInfo)>
Get all available branches
Sourcepub fn current_state(&self) -> Option<&ConversationSnapshot>
pub fn current_state(&self) -> Option<&ConversationSnapshot>
Get the current state
Sourcepub fn undo_history(&self) -> Vec<&ConversationSnapshot>
pub fn undo_history(&self) -> Vec<&ConversationSnapshot>
Get undo history (for visualization)
Sourcepub fn redo_history(&self) -> Vec<&ConversationSnapshot>
pub fn redo_history(&self) -> Vec<&ConversationSnapshot>
Get redo history (for visualization)
Sourcepub fn create_checkpoint(&mut self, name: String) -> CodexResult<Uuid>
pub fn create_checkpoint(&mut self, name: String) -> CodexResult<Uuid>
Create a checkpoint (special snapshot with tag)
Sourcepub fn restore_checkpoint(
&mut self,
checkpoint_id: Uuid,
) -> CodexResult<Option<ConversationSnapshot>>
pub fn restore_checkpoint( &mut self, checkpoint_id: Uuid, ) -> CodexResult<Option<ConversationSnapshot>>
Restore from a checkpoint
Sourcepub fn memory_info(&self) -> MemoryInfo
pub fn memory_info(&self) -> MemoryInfo
Get memory usage information
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UndoRedoManager
impl RefUnwindSafe for UndoRedoManager
impl Send for UndoRedoManager
impl Sync for UndoRedoManager
impl Unpin for UndoRedoManager
impl UnwindSafe for UndoRedoManager
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Converts
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Converts
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Converts
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Converts
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more