Skip to main content

edit_delta_to_input_edit

Function edit_delta_to_input_edit 

Source
pub fn edit_delta_to_input_edit(d: EditDelta) -> InputEdit
Expand description

Convert a [lattice_protocol::edit::EditDelta] (parser-agnostic edit shape) to a [tree_sitter::InputEdit] (parser-shaped edit the cached tree mutates by). Six casts + a struct constructor; runs in the noise floor (~1ns).

Free function rather than From impl because both types are foreign to this crate – Rust’s orphan rule blocks the trait impl. Lives in lattice-syntax (not lattice-protocol) so the protocol crate stays parser-agnostic. The fields map 1:1: Position.line -> Point.row, Position.byte -> Point.column (both are byte-within-line, despite the column-named field).