pub trait ConsumeHunk {
type Out;
// Required methods
fn consume_hunk(
&mut self,
header: HunkHeader,
lines: &[(DiffLineKind, &[u8])],
) -> Result<()>;
fn finish(self) -> Self::Out;
}Available on crate feature
blob only.Expand description
A utility trait for use in UnifiedDiff.
Required Associated Types§
Required Methods§
Sourcefn consume_hunk(
&mut self,
header: HunkHeader,
lines: &[(DiffLineKind, &[u8])],
) -> Result<()>
fn consume_hunk( &mut self, header: HunkHeader, lines: &[(DiffLineKind, &[u8])], ) -> Result<()>
Consume a single hunk which is represented by its lines, each of which with a DiffLineKind value
to know if it’s added, removed or context.
The header specifies hunk offsets, which positions the lines in the old and new file respectively.
Note that the UnifiedDiff sink will wrap its output in an std::io::Result.
After this method returned its first error, it will not be called anymore.
Implementors§
Source§impl<D> ConsumeHunk for ConsumeBinaryHunk<'_, D>where
D: ConsumeBinaryHunkDelegate,
An implementation that fails if the input isn’t UTF-8.
impl<D> ConsumeHunk for ConsumeBinaryHunk<'_, D>where
D: ConsumeBinaryHunkDelegate,
An implementation that fails if the input isn’t UTF-8.