pub trait ConsumeHunk {
type Out;
// Required methods
fn consume_hunk(
&mut self,
before_hunk_start: u32,
before_hunk_len: u32,
after_hunk_start: u32,
after_hunk_len: u32,
header: &str,
hunk: &[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,
before_hunk_start: u32,
before_hunk_len: u32,
after_hunk_start: u32,
after_hunk_len: u32,
header: &str,
hunk: &[u8],
) -> Result<()>
fn consume_hunk( &mut self, before_hunk_start: u32, before_hunk_len: u32, after_hunk_start: u32, after_hunk_len: u32, header: &str, hunk: &[u8], ) -> Result<()>
Consume a single hunk in unified diff format, that would be prefixed with header.
Note that all newlines are added.
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.
The following is hunk-related information and the same that is used in the header.
before_hunk_startis the 1-based first line of this hunk in the old file.before_hunk_lenthe amount of lines of this hunk in the old file.after_hunk_startis the 1-based first line of this hunk in the new file.after_hunk_lenthe amount of lines of this hunk in the new file.
Implementations on Foreign Types§
Source§impl ConsumeHunk for String
An implementation that fails if the input isn’t UTF-8.
impl ConsumeHunk for String
An implementation that fails if the input isn’t UTF-8.
Source§impl ConsumeHunk for Vec<u8>
An implementation that writes hunks into a byte buffer.
impl ConsumeHunk for Vec<u8>
An implementation that writes hunks into a byte buffer.