Trait parsepatch::parser::Diff

source ·
pub trait Diff {
    // Required methods
    fn set_info(
        &mut self,
        old_name: &str,
        new_name: &str,
        op: FileOp,
        binary_sizes: Option<Vec<BinaryHunk>>,
        file_mode: Option<FileMode>
    );
    fn add_line(&mut self, old_line: u32, new_line: u32, line: &[u8]);
    fn new_hunk(&mut self);
    fn close(&mut self);
}
Expand description

A type to handle lines in a diff

Required Methods§

source

fn set_info( &mut self, old_name: &str, new_name: &str, op: FileOp, binary_sizes: Option<Vec<BinaryHunk>>, file_mode: Option<FileMode> )

Set the file info

source

fn add_line(&mut self, old_line: u32, new_line: u32, line: &[u8])

Add a line in the diff

If a line is added (+) then old_line is 0 and new_line is the line in the destination file.

If a line is removed (-) then old_line is the line in the source file and new_line is 0.

If a line is nothing ( ) then old_line is the line in the source file and new_line is the line in the destination file.

source

fn new_hunk(&mut self)

A new hunk is created

source

fn close(&mut self)

Close the diff: no more lines will be added

Implementors§