Trait 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§