Skip to main content

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 set_diff_max_bytes(max_bytes: u64)

Source

pub fn set_full_context_max_bytes(max_bytes: u64)

Source

pub fn set_diff_defer(enabled: bool)

Source

pub fn compute_diff(old: &str, new: &str) -> DiffResult

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 from_file_pair_bytes( new_path: PathBuf, old_bytes: Vec<u8>, new_bytes: Vec<u8>, ) -> Self

Create from a single file pair (bytes, with binary detection).

Source

pub fn from_file_pairs(pairs: Vec<(PathBuf, String, String)>) -> Self

Create from multiple file pairs.

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 file_contents(&self, idx: usize) -> Option<(&str, &str)>

Source

pub fn file_contents_arc(&self, idx: usize) -> Option<(Arc<str>, Arc<str>)>

Source

pub fn current_file_is_binary(&self) -> bool

Check if the current file is binary

Source

pub fn current_file_diff_disabled(&self) -> bool

True when diffing is not ready for the current file (deferred/disabled)

Source

pub fn diff_status(&self, idx: usize) -> DiffStatus

Source

pub fn file_is_large(&self, idx: usize) -> bool

Source

pub fn current_file_is_large(&self) -> bool

Source

pub fn current_navigator_is_placeholder(&self) -> bool

Source

pub fn current_file_diff_status(&self) -> DiffStatus

Source

pub fn mark_diff_computing(&mut self, idx: usize)

Source

pub fn mark_diff_failed(&mut self, idx: usize)

Source

pub fn apply_diff_result(&mut self, idx: usize, diff: DiffResult)

Source

pub fn ensure_full_navigator(&mut self, idx: usize)

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 blame_sources(&self) -> Option<(BlameSource, BlameSource)>

Blame sources for old/new content when in git mode.

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.