pub struct ChangeDelta<T> { /* private fields */ }Expand description
Describes a change-delta representing replaced content between original and revised sequences.
Implementations§
Source§impl<T> ChangeDelta<T>
impl<T> ChangeDelta<T>
Sourcepub fn new(source: Chunk<T>, target: Chunk<T>) -> Self
pub fn new(source: Chunk<T>, target: Chunk<T>) -> Self
Creates a new ChangeDelta with the given source and target chunks.
Sourcepub fn into_delta(self) -> Delta<T>
pub fn into_delta(self) -> Delta<T>
Consumes self and returns the inner Delta.
Sourcepub fn apply_to(&self, target: &mut Vec<T>) -> Result<(), PatchError>
pub fn apply_to(&self, target: &mut Vec<T>) -> Result<(), PatchError>
Applies this change delta to the target vector.
Replaces the element range at the source chunk’s position with the target chunk’s lines.
Sourcepub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>
pub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>
Restores (un-applies) this change delta on the target sequence.
Replaces the element range at the target chunk’s position with the original source lines.
Sourcepub fn apply_fuzzy_to_at(
&self,
target: &mut Vec<T>,
_fuzz: usize,
position: usize,
) -> Result<(), PatchError>
pub fn apply_fuzzy_to_at( &self, target: &mut Vec<T>, _fuzz: usize, position: usize, ) -> Result<(), PatchError>
Applies the patch with a fuzzy tolerance context offset.
Sourcepub fn with_chunks(&self, original: Chunk<T>, revised: Chunk<T>) -> Self
pub fn with_chunks(&self, original: Chunk<T>, revised: Chunk<T>) -> Self
Creates a new ChangeDelta with custom source and target chunks.
Trait Implementations§
Source§impl<T: Clone> Clone for ChangeDelta<T>
impl<T: Clone> Clone for ChangeDelta<T>
Source§fn clone(&self) -> ChangeDelta<T>
fn clone(&self) -> ChangeDelta<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for ChangeDelta<T>
impl<T: Debug> Debug for ChangeDelta<T>
Source§impl<T: Debug> Display for ChangeDelta<T>
impl<T: Debug> Display for ChangeDelta<T>
impl<T: Eq> Eq for ChangeDelta<T>
Source§impl<T> From<ChangeDelta<T>> for Delta<T>
impl<T> From<ChangeDelta<T>> for Delta<T>
Source§fn from(change: ChangeDelta<T>) -> Self
fn from(change: ChangeDelta<T>) -> Self
Converts to this type from the input type.
Source§impl<T: Hash> Hash for ChangeDelta<T>
impl<T: Hash> Hash for ChangeDelta<T>
Source§impl<T: PartialEq> PartialEq for ChangeDelta<T>
impl<T: PartialEq> PartialEq for ChangeDelta<T>
impl<T: PartialEq> StructuralPartialEq for ChangeDelta<T>
Auto Trait Implementations§
impl<T> Freeze for ChangeDelta<T>
impl<T> RefUnwindSafe for ChangeDelta<T>where
Delta<T>: RefUnwindSafe,
impl<T> Send for ChangeDelta<T>
impl<T> Sync for ChangeDelta<T>
impl<T> Unpin for ChangeDelta<T>
impl<T> UnsafeUnpin for ChangeDelta<T>where
Delta<T>: UnsafeUnpin,
impl<T> UnwindSafe for ChangeDelta<T>where
Delta<T>: UnwindSafe,
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