pub struct EditStep {
pub offset: usize,
pub deleted: String,
pub inserted: String,
}Expand description
A single edit step: insert, delete, or replace at a char offset. Each step stores enough information to be inverted.
Fields§
§offset: usizeChar offset where the edit starts.
deleted: StringText that was deleted (empty for pure inserts).
inserted: StringText that was inserted (empty for pure deletes).
Implementations§
Source§impl EditStep
impl EditStep
Sourcepub fn replace(
offset: usize,
deleted: impl Into<String>,
inserted: impl Into<String>,
) -> Self
pub fn replace( offset: usize, deleted: impl Into<String>, inserted: impl Into<String>, ) -> Self
Create a replace step.
Sourcepub fn inserted_len(&self) -> usize
pub fn inserted_len(&self) -> usize
Number of chars inserted.
Sourcepub fn deleted_len(&self) -> usize
pub fn deleted_len(&self) -> usize
Number of chars deleted.
Sourcepub fn is_single_char_insert(&self) -> bool
pub fn is_single_char_insert(&self) -> bool
True if this is a single character insert (for coalescing).
Sourcepub fn is_single_char_delete(&self) -> bool
pub fn is_single_char_delete(&self) -> bool
True if this is a single character delete (for coalescing).
Trait Implementations§
impl Eq for EditStep
impl StructuralPartialEq for EditStep
Auto Trait Implementations§
impl Freeze for EditStep
impl RefUnwindSafe for EditStep
impl Send for EditStep
impl Sync for EditStep
impl Unpin for EditStep
impl UnsafeUnpin for EditStep
impl UnwindSafe for EditStep
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