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: usizeCurrently selected file index
Implementations§
Source§impl MultiFileDiff
impl MultiFileDiff
pub fn set_diff_max_bytes(max_bytes: u64)
pub fn set_full_context_max_bytes(max_bytes: u64)
pub fn set_diff_defer(enabled: bool)
pub fn compute_diff(old: &str, new: &str) -> DiffResult
Sourcepub fn from_git_changes(
repo_root: PathBuf,
changes: Vec<ChangedFile>,
) -> Result<Self, MultiDiffError>
pub fn from_git_changes( repo_root: PathBuf, changes: Vec<ChangedFile>, ) -> Result<Self, MultiDiffError>
Create from a list of changed files (git mode)
Sourcepub fn from_git_staged(
repo_root: PathBuf,
changes: Vec<ChangedFile>,
) -> Result<Self, MultiDiffError>
pub fn from_git_staged( repo_root: PathBuf, changes: Vec<ChangedFile>, ) -> Result<Self, MultiDiffError>
Create from staged git changes (index vs HEAD)
Sourcepub fn from_git_index_range(
repo_root: PathBuf,
changes: Vec<ChangedFile>,
from: String,
to_index: bool,
) -> Result<Self, MultiDiffError>
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
Sourcepub fn from_git_range(
repo_root: PathBuf,
changes: Vec<ChangedFile>,
from: String,
to: String,
) -> Result<Self, MultiDiffError>
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)
Sourcepub fn from_directories(
old_dir: &Path,
new_dir: &Path,
) -> Result<Self, MultiDiffError>
pub fn from_directories( old_dir: &Path, new_dir: &Path, ) -> Result<Self, MultiDiffError>
Create from two directories
Sourcepub fn from_file_pair(
_old_path: PathBuf,
new_path: PathBuf,
old_content: String,
new_content: String,
) -> Self
pub fn from_file_pair( _old_path: PathBuf, new_path: PathBuf, old_content: String, new_content: String, ) -> Self
Create from a single file pair
Sourcepub fn from_file_pair_bytes(
new_path: PathBuf,
old_bytes: Vec<u8>,
new_bytes: Vec<u8>,
) -> Self
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).
Sourcepub fn from_file_pairs(pairs: Vec<(PathBuf, String, String)>) -> Self
pub fn from_file_pairs(pairs: Vec<(PathBuf, String, String)>) -> Self
Create from multiple file pairs.
Get the navigator for the currently selected file
Sourcepub fn current_file(&self) -> Option<&FileEntry>
pub fn current_file(&self) -> Option<&FileEntry>
Get the current file entry
pub fn file_contents(&self, idx: usize) -> Option<(&str, &str)>
pub fn file_contents_arc(&self, idx: usize) -> Option<(Arc<str>, Arc<str>)>
Sourcepub fn current_file_is_binary(&self) -> bool
pub fn current_file_is_binary(&self) -> bool
Check if the current file is binary
Sourcepub fn current_file_diff_disabled(&self) -> bool
pub fn current_file_diff_disabled(&self) -> bool
True when diffing is not ready for the current file (deferred/disabled)
pub fn diff_status(&self, idx: usize) -> DiffStatus
pub fn file_is_large(&self, idx: usize) -> bool
pub fn current_file_is_large(&self) -> bool
pub fn current_file_diff_status(&self) -> DiffStatus
pub fn mark_diff_computing(&mut self, idx: usize)
pub fn mark_diff_failed(&mut self, idx: usize)
pub fn apply_diff_result(&mut self, idx: usize, diff: DiffResult)
Sourcepub fn select_file(&mut self, index: usize)
pub fn select_file(&mut self, index: usize)
Select file by index
Sourcepub fn file_count(&self) -> usize
pub fn file_count(&self) -> usize
Total number of files
Sourcepub fn is_git_mode(&self) -> bool
pub fn is_git_mode(&self) -> bool
True if this diff was created from git changes
Sourcepub fn git_range_display(&self) -> Option<(String, String)>
pub fn git_range_display(&self) -> Option<(String, String)>
Return a display-friendly git range for header usage (if applicable).
Sourcepub fn blame_sources(&self) -> Option<(BlameSource, BlameSource)>
pub fn blame_sources(&self) -> Option<(BlameSource, BlameSource)>
Blame sources for old/new content when in git mode.
Sourcepub fn current_step_direction(&self) -> StepDirection
pub fn current_step_direction(&self) -> StepDirection
Get the step direction of current navigator (if loaded)
Sourcepub fn is_multi_file(&self) -> bool
pub fn is_multi_file(&self) -> bool
Check if we have multiple files
Sourcepub fn total_stats(&self) -> (usize, usize)
pub fn total_stats(&self) -> (usize, usize)
Get total stats across all files
Sourcepub fn current_old_is_empty(&self) -> bool
pub fn current_old_is_empty(&self) -> bool
Check if current file’s old content is empty
Sourcepub fn current_new_is_empty(&self) -> bool
pub fn current_new_is_empty(&self) -> bool
Check if current file’s new content is empty
Sourcepub fn refresh_all_from_git(&mut self) -> bool
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
Sourcepub fn refresh_current_file(&mut self)
pub fn refresh_current_file(&mut self)
Refresh the current file from disk (re-read and re-diff)