pub struct IncrementalEditSet {
pub edits: Vec<IncrementalEdit>,
}Expand description
Collection of incremental edits
Fields§
§edits: Vec<IncrementalEdit>Implementations§
Source§impl IncrementalEditSet
impl IncrementalEditSet
Sourcepub fn add(&mut self, edit: IncrementalEdit)
pub fn add(&mut self, edit: IncrementalEdit)
Add an edit to the set
Sourcepub fn normalize_and_validate(
&mut self,
allow_overlaps: bool,
filter_no_ops: bool,
) -> Result<(), IncrementalEditBatchError>
pub fn normalize_and_validate( &mut self, allow_overlaps: bool, filter_no_ops: bool, ) -> Result<(), IncrementalEditBatchError>
Normalize edit ordering for deterministic reverse-application and validate batch shape.
Normalization behavior:
- removes obvious no-op edits when
filter_no_opsistrue - sorts edits in deterministic reverse-application order (highest byte offset first)
Validation behavior:
- rejects backward ranges (
start_byte > old_end_byte) - rejects overlaps after normalization unless
allow_overlapsistrue
Sourcepub fn sort_reverse(&mut self)
pub fn sort_reverse(&mut self)
Sort edits in reverse order (for applying from end to start)
Sourcepub fn sort_reverse_deterministic(&mut self)
pub fn sort_reverse_deterministic(&mut self)
Sort edits in a deterministic reverse-application order.
This keeps behavior stable even when multiple edits share a start byte.
Sourcepub fn total_byte_shift(&self) -> isize
pub fn total_byte_shift(&self) -> isize
Get the total byte shift for all edits
Sourcepub fn apply_to_string(&self, source: &str) -> String
pub fn apply_to_string(&self, source: &str) -> String
Apply edits to a string
Sourcepub fn normalize_for_source(&self, source: &str) -> Option<Vec<IncrementalEdit>>
pub fn normalize_for_source(&self, source: &str) -> Option<Vec<IncrementalEdit>>
Validate and normalize edits for deterministic reverse-order application.
Returns None when any edit is not safely mappable for the given source
(backwards range, out-of-bounds range, or non-UTF-8 boundaries), or when
non-empty ranges overlap.
Trait Implementations§
Source§impl Clone for IncrementalEditSet
impl Clone for IncrementalEditSet
Source§fn clone(&self) -> IncrementalEditSet
fn clone(&self) -> IncrementalEditSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IncrementalEditSet
impl Debug for IncrementalEditSet
Source§impl Default for IncrementalEditSet
impl Default for IncrementalEditSet
Source§fn default() -> IncrementalEditSet
fn default() -> IncrementalEditSet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for IncrementalEditSet
impl RefUnwindSafe for IncrementalEditSet
impl Send for IncrementalEditSet
impl Sync for IncrementalEditSet
impl Unpin for IncrementalEditSet
impl UnsafeUnpin for IncrementalEditSet
impl UnwindSafe for IncrementalEditSet
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