pub struct EditDelta {
pub start_byte: u32,
pub old_end_byte: u32,
pub new_end_byte: u32,
pub start_position: Position,
pub old_end_position: Position,
pub new_end_position: Position,
}Expand description
Tree-sitter-shaped description of a single applied edit.
Carries the six fields tree-sitter’s InputEdit needs (three
byte offsets + three line/byte positions) so a syntax worker
can drive incremental reparse without re-querying the buffer.
Produced as a by-product of Buffer::apply_edit (zero new
rope reads – every field is already computed there); rides
on lattice_core::AppliedEdit. The actual tree_sitter::InputEdit
conversion lives in lattice-syntax so this crate stays
parser-agnostic.
Field semantics match tree-sitter:
start_byte: byte offset of the edit’s start in the pre-edit buffer.old_end_byte: byte offset of the end of the deleted span in the pre-edit buffer (==start_bytefor pure inserts).new_end_byte: byte offset of the end of the inserted span in the post-edit buffer (==start_bytefor pure deletes).start_position/old_end_position/new_end_position: the same three points in line-and-byte-within-line form.Position.byteis byte-within-line, which already matches tree-sitter’sPoint.columnsemantics (column-as-bytes).
Copy so callers pass it through chains by register move,
not by Arc bump. 36 bytes – fits one cache line.
The producer (lattice_core::Buffer::apply_edit) saturates each byte
offset at u32::MAX rather than panicking on a buffer over 4 GiB.
Fields§
§start_byte: u32Absolute byte offset (from the start of the buffer) where the edit begins; the same in the pre- and post-edit buffer.
old_end_byte: u32Absolute byte offset of the end of the removed span, in the pre-edit
buffer. Equals start_byte for a pure insert.
new_end_byte: u32Absolute byte offset of the end of the inserted span, in the post-edit
buffer. Equals start_byte for a pure delete.
start_position: Positionstart_byte as (line, byte-within-line).
old_end_position: Positionold_end_byte as (line, byte-within-line), pre-edit.
new_end_position: Positionnew_end_byte as (line, byte-within-line), post-edit.
Trait Implementations§
impl Copy for EditDelta
Source§impl<'de> Deserialize<'de> for EditDelta
impl<'de> Deserialize<'de> for EditDelta
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 EditDelta
impl StructuralPartialEq for EditDelta
Auto Trait Implementations§
impl Freeze for EditDelta
impl RefUnwindSafe for EditDelta
impl Send for EditDelta
impl Sync for EditDelta
impl Unpin for EditDelta
impl UnsafeUnpin for EditDelta
impl UnwindSafe for EditDelta
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>,
§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.