pub struct Journal { /* private fields */ }Expand description
A journal that records operations for undo/redo support.
Implementations§
Source§impl Journal
impl Journal
Sourcepub fn start_recording(&mut self)
pub fn start_recording(&mut self)
Start recording operations.
Sourcepub fn stop_recording(&mut self)
pub fn stop_recording(&mut self)
Stop recording operations.
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Whether recording is active.
Sourcepub fn undo(&mut self) -> Option<Operation>
pub fn undo(&mut self) -> Option<Operation>
Pop the last operation for undoing. Returns the operation to undo. The caller is responsible for applying the inverse.
Sourcepub fn inverse(op: &Operation) -> Operation
pub fn inverse(op: &Operation) -> Operation
Get the inverse of an operation (what to do to undo it).
Sourcepub fn undo_count(&self) -> usize
pub fn undo_count(&self) -> usize
Number of undo steps available.
Sourcepub fn redo_count(&self) -> usize
pub fn redo_count(&self) -> usize
Number of redo steps available.
Sourcepub fn begin_batch(&mut self, description: &str) -> BatchBuilder<'_>
pub fn begin_batch(&mut self, description: &str) -> BatchBuilder<'_>
Begin a batch operation. Returns a BatchBuilder.
Sourcepub fn from_bytes(data: &[u8]) -> Option<Self>
pub fn from_bytes(data: &[u8]) -> Option<Self>
Deserialize journal from bytes.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Journal
impl RefUnwindSafe for Journal
impl Send for Journal
impl Sync for Journal
impl Unpin for Journal
impl UnsafeUnpin for Journal
impl UnwindSafe for Journal
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> 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