pub struct InsertDelta<T> { /* private fields */ }Expand description
Describes an insert-delta representing new content added to a target sequence.
Implementations§
Source§impl<T> InsertDelta<T>
impl<T> InsertDelta<T>
Sourcepub fn new(original: Chunk<T>, revised: Chunk<T>) -> Self
pub fn new(original: Chunk<T>, revised: Chunk<T>) -> Self
Creates a new InsertDelta 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>where
T: Clone,
pub fn apply_to(&self, target: &mut Vec<T>) -> Result<(), PatchError>where
T: Clone,
Applies this insert delta to the target vector.
Inserts the revised chunk lines at the source chunk’s target position.
Sourcepub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>
pub fn restore(&self, target: &mut Vec<T>) -> Result<(), PatchError>
Restores (un-applies) this insert delta on the target vector.
Removes/drains the inserted target lines from the target vector.
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 InsertDelta with custom source and target chunks.
Trait Implementations§
Source§impl<T: Clone> Clone for InsertDelta<T>
impl<T: Clone> Clone for InsertDelta<T>
Source§fn clone(&self) -> InsertDelta<T>
fn clone(&self) -> InsertDelta<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 InsertDelta<T>
impl<T: Debug> Debug for InsertDelta<T>
Source§impl<T: Debug> Display for InsertDelta<T>
impl<T: Debug> Display for InsertDelta<T>
impl<T: Eq> Eq for InsertDelta<T>
Source§impl<T> From<InsertDelta<T>> for Delta<T>
impl<T> From<InsertDelta<T>> for Delta<T>
Source§fn from(insert: InsertDelta<T>) -> Self
fn from(insert: InsertDelta<T>) -> Self
Converts to this type from the input type.
Source§impl<T: Hash> Hash for InsertDelta<T>
impl<T: Hash> Hash for InsertDelta<T>
Source§impl<T: PartialEq> PartialEq for InsertDelta<T>
impl<T: PartialEq> PartialEq for InsertDelta<T>
impl<T: PartialEq> StructuralPartialEq for InsertDelta<T>
Auto Trait Implementations§
impl<T> Freeze for InsertDelta<T>
impl<T> RefUnwindSafe for InsertDelta<T>where
Delta<T>: RefUnwindSafe,
impl<T> Send for InsertDelta<T>
impl<T> Sync for InsertDelta<T>
impl<T> Unpin for InsertDelta<T>
impl<T> UnsafeUnpin for InsertDelta<T>where
Delta<T>: UnsafeUnpin,
impl<T> UnwindSafe for InsertDelta<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