Struct StackItem
pub struct StackItem<T> {
pub meta: T,
/* private fields */
}Expand description
A unit of work for the UndoManager. It contains a compressed information about all updates and deletions tracked by a corresponding undo manager. Whenever an [UndoManger::undo] or UndoManager::redo methods are called a last StackItem is being used to modify a state of the document.
Stack items are stored internally by undo manager and created automatically whenever a new update from tracked shared type and transaction of tracked origin has been committed within a threshold specified by Options::capture_timeout_millis time window since the previous stack item creation. They can also be created explicitly by calling UndoManager::reset, which marks the end of the last stack item batch.
Fields§
§meta: TA custom user metadata that can be attached to a particular StackItem. It can be used to carry over the additional information (such as ie. user cursor position) between undo/redo operations.
Implementations§
§impl<M> StackItem<M>
impl<M> StackItem<M>
pub fn with_meta( deletions: DeleteSet, insertions: DeleteSet, meta: M, ) -> StackItem<M>
pub fn deletions(&self) -> &DeleteSet
pub fn deletions(&self) -> &DeleteSet
A set of identifiers of element deleted at part of the timeframe current StackItem is responsible for.
pub fn insertions(&self) -> &DeleteSet
pub fn insertions(&self) -> &DeleteSet
A set of identifiers of element inserted at part of the timeframe current StackItem is responsible for.
Trait Implementations§
§impl<'de, T> Deserialize<'de> for StackItem<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for StackItem<T>where
T: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<StackItem<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<StackItem<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<T> Serialize for StackItem<T>where
T: Serialize,
impl<T> Serialize for StackItem<T>where
T: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl<T> Eq for StackItem<T>where
T: Eq,
impl<T> StructuralPartialEq for StackItem<T>
Auto Trait Implementations§
impl<T> Freeze for StackItem<T>where
T: Freeze,
impl<T> RefUnwindSafe for StackItem<T>where
T: RefUnwindSafe,
impl<T> Send for StackItem<T>where
T: Send,
impl<T> Sync for StackItem<T>where
T: Sync,
impl<T> Unpin for StackItem<T>where
T: Unpin,
impl<T> UnwindSafe for StackItem<T>where
T: UnwindSafe,
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.