MultiFileDiff

Struct MultiFileDiff 

Source
pub struct MultiFileDiff {
    pub files: Vec<FileEntry>,
    pub selected_index: usize,
    /* private fields */
}
Expand description

Multi-file diff session

Fields§

§files: Vec<FileEntry>

All files being diffed

§selected_index: usize

Currently selected file index

Implementations§

Source§

impl MultiFileDiff

Source

pub fn from_git_changes( repo_root: PathBuf, changes: Vec<ChangedFile>, ) -> Result<Self, MultiDiffError>

Create from a list of changed files (git mode)

Source

pub fn from_git_staged( repo_root: PathBuf, changes: Vec<ChangedFile>, ) -> Result<Self, MultiDiffError>

Create from staged git changes (index vs HEAD)

Source

pub fn from_git_index_range( repo_root: PathBuf, changes: Vec<ChangedFile>, from: String, to_index: bool, ) -> Result<Self, MultiDiffError>

Create from a git range where one side is the staged index

Source

pub fn from_git_range( repo_root: PathBuf, changes: Vec<ChangedFile>, from: String, to: String, ) -> Result<Self, MultiDiffError>

Create from a git range (from..to)

Source

pub fn from_directories( old_dir: &Path, new_dir: &Path, ) -> Result<Self, MultiDiffError>

Create from two directories

Source

pub fn from_file_pair( _old_path: PathBuf, new_path: PathBuf, old_content: String, new_content: String, ) -> Self

Create from a single file pair

Source

pub fn current_navigator(&mut self) -> &mut DiffNavigator

Get the navigator for the currently selected file

Source

pub fn current_file(&self) -> Option<&FileEntry>

Get the current file entry

Source

pub fn next_file(&mut self) -> bool

Select next file

Source

pub fn prev_file(&mut self) -> bool

Select previous file

Source

pub fn select_file(&mut self, index: usize)

Select file by index

Source

pub fn file_count(&self) -> usize

Total number of files

Source

pub fn repo_root(&self) -> Option<&Path>

Repository root path (git mode only)

Source

pub fn is_git_mode(&self) -> bool

True if this diff was created from git changes

Source

pub fn git_range_display(&self) -> Option<(String, String)>

Return a display-friendly git range for header usage (if applicable).

Source

pub fn current_step_direction(&self) -> StepDirection

Get the step direction of current navigator (if loaded)

Source

pub fn is_multi_file(&self) -> bool

Check if we have multiple files

Source

pub fn total_stats(&self) -> (usize, usize)

Get total stats across all files

Source

pub fn current_old_is_empty(&self) -> bool

Check if current file’s old content is empty

Source

pub fn current_new_is_empty(&self) -> bool

Check if current file’s new content is empty

Source

pub fn refresh_all_from_git(&mut self) -> bool

Refresh all files from git (re-scan for uncommitted changes) Returns true if successful, false if not in git mode

Source

pub fn refresh_current_file(&mut self)

Refresh the current file from disk (re-read and re-diff)

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.