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 crate::blob::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 contains a DiffLineKind
and the original token bytes (&[u8]) for that line without the unified diff prefix character.
The header specifies hunk offsets, which positions the lines in the old and new file respectively.
Note that crate::blob::UnifiedDiff will wrap its output in an std::io::Result.
After this method returned its first error, it will not be called anymore.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
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.