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 using deterministic fallback semantics.
This is intentionally more tolerant than Self::normalize_for_source:
the incremental fast path rejects overlapping or unmappable batches,
while this fallback applies every edit that still maps safely in reverse
byte order and skips edits that cannot be applied without panicking.
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
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more