pub enum EditorOp {
Insert {
offset: usize,
text: String,
},
Delete {
offset: usize,
len: usize,
},
}Expand description
A real editor operation captured from the editor’s change event
(DocumentListener.documentChanged / onDidChangeTextDocument),
expressed as an absolute-offset mutation in byte units — consistent
with the byte-offset cursor convention used throughout this module’s Yrs
apply path ([apply_ops]).
A replacement (the editor reports an old fragment + a new fragment at the
same offset) is captured as a EditorOp::Delete of the old length
followed by an EditorOp::Insert of the new text at the same offset; the
reporter is responsible for that split so replay stays a flat, ordered
sequence. Ops are recorded and replayed in the order the editor performed
them, so each op’s offset is absolute against the document state after all
prior ops in the sequence (exactly how the editor’s own events behave).
Variants§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for EditorOp
impl<'de> Deserialize<'de> for EditorOp
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>,
impl Eq for EditorOp
impl StructuralPartialEq for EditorOp
Auto Trait Implementations§
impl Forget for EditorOp
impl Freeze for EditorOp
impl RefUnwindSafe for EditorOp
impl Send for EditorOp
impl Sync for EditorOp
impl Unpin for EditorOp
impl UnsafeUnpin for EditorOp
impl UnwindSafe for EditorOp
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> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.