Skip to main content

IncrementalEditSet

Struct IncrementalEditSet 

Source
pub struct IncrementalEditSet {
    pub edits: Vec<IncrementalEdit>,
}
Expand description

Collection of incremental edits

Fields§

§edits: Vec<IncrementalEdit>

Implementations§

Source§

impl IncrementalEditSet

Source

pub fn new() -> Self

Create a new empty edit set

Source

pub fn add(&mut self, edit: IncrementalEdit)

Add an edit to the set

Source

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_ops is true
  • 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_overlaps is true
Source

pub fn sort(&mut self)

Sort edits by position (for correct application order)

Source

pub fn sort_reverse(&mut self)

Sort edits in reverse order (for applying from end to start)

Source

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.

Source

pub fn is_empty(&self) -> bool

Check if the edit set is empty

Source

pub fn total_byte_shift(&self) -> isize

Get the total byte shift for all edits

Source

pub fn apply_to_string(&self, source: &str) -> String

Apply edits to a string

Source

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

Source§

fn clone(&self) -> IncrementalEditSet

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for IncrementalEditSet

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IncrementalEditSet

Source§

fn default() -> IncrementalEditSet

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more