pub struct DeleteDelta<T> { /* private fields */ }Expand description
Describes a delete-delta representing removed content from an original sequence.
Implementations§
Source§impl<T> DeleteDelta<T>
impl<T> DeleteDelta<T>
Sourcepub fn new(original: Chunk<T>, revised: Chunk<T>) -> Self
pub fn new(original: Chunk<T>, revised: Chunk<T>) -> Self
Creates a new DeleteDelta with the given original (source) and revised (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 delete delta to the target vector.
Drains/removes the elements specified by the source chunk’s range.
Sourcepub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>where
T: Clone,
pub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>where
T: Clone,
Restores (un-applies) this delete delta on the target vector.
Re-inserts the removed original lines back into the target vector at the recorded position.
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 DeleteDelta with custom source and target chunks.
Trait Implementations§
Source§impl<T: Clone> Clone for DeleteDelta<T>
impl<T: Clone> Clone for DeleteDelta<T>
Source§fn clone(&self) -> DeleteDelta<T>
fn clone(&self) -> DeleteDelta<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 DeleteDelta<T>
impl<T: Debug> Debug for DeleteDelta<T>
Source§impl<T: Debug> Display for DeleteDelta<T>
impl<T: Debug> Display for DeleteDelta<T>
impl<T: Eq> Eq for DeleteDelta<T>
Source§impl<T> From<DeleteDelta<T>> for Delta<T>
impl<T> From<DeleteDelta<T>> for Delta<T>
Source§fn from(delete: DeleteDelta<T>) -> Self
fn from(delete: DeleteDelta<T>) -> Self
Converts to this type from the input type.
Source§impl<T: Hash> Hash for DeleteDelta<T>
impl<T: Hash> Hash for DeleteDelta<T>
Source§impl<T: PartialEq> PartialEq for DeleteDelta<T>
impl<T: PartialEq> PartialEq for DeleteDelta<T>
impl<T: PartialEq> StructuralPartialEq for DeleteDelta<T>
Auto Trait Implementations§
impl<T> Freeze for DeleteDelta<T>
impl<T> RefUnwindSafe for DeleteDelta<T>where
Delta<T>: RefUnwindSafe,
impl<T> Send for DeleteDelta<T>
impl<T> Sync for DeleteDelta<T>
impl<T> Unpin for DeleteDelta<T>
impl<T> UnsafeUnpin for DeleteDelta<T>where
Delta<T>: UnsafeUnpin,
impl<T> UnwindSafe for DeleteDelta<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