pub struct Platform<'old, 'new> {
pub old: Object<'old>,
pub new: Object<'new>,
pub algo: Algorithm,
}
Expand description
A platform to keep temporary information to perform line diffs on modified blobs.
Fields§
§old: Object<'old>
The previous version of the blob.
new: Object<'new>
The new version of the blob.
algo: Algorithm
The algorithm to use when calling imara_diff::diff().
This value is determined by the diff.algorithm
configuration.
Implementations§
source§impl<'old, 'new> Platform<'old, 'new>
impl<'old, 'new> Platform<'old, 'new>
sourcepub fn lines<FnH, E>(&self, process_hunk: FnH) -> Result<(), E>where
FnH: FnMut(Change<'_, '_>) -> Result<(), E>,
E: Error,
pub fn lines<FnH, E>(&self, process_hunk: FnH) -> Result<(), E>where FnH: FnMut(Change<'_, '_>) -> Result<(), E>, E: Error,
Perform a diff on lines between the old and the new version of a blob, passing each hunk of lines to process_hunk
.
The diffing algorithm is determined by the diff.algorithm
configuration.
Note that you can invoke the diff more flexibly as well.
sourcepub fn line_counts(&self) -> Counter<()>
pub fn line_counts(&self) -> Counter<()>
Count the amount of removed and inserted lines efficiently.
sourcepub fn line_tokens(&self) -> InternedInput<&[u8]>
pub fn line_tokens(&self) -> InternedInput<&[u8]>
Return a tokenizer which treats lines as smallest unit for use in a diff operation.
The line separator is determined according to normal git rules and filters.