#[non_exhaustive]pub struct DiffOptions {
pub context_lines: usize,
pub inter_hunk_context: usize,
pub algorithm: DiffAlgorithm,
pub indent_heuristic: bool,
pub renames: RenameDetection,
pub filter: Option<DiffFilter>,
pub whitespace: WhitespaceMode,
pub word_level_inline: bool,
pub function_context: bool,
/* private fields */
}Expand description
Line-diff options shared by structured output, log patches, and benchmarks.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.context_lines: usizeUnchanged context lines around each change (Git -U, default 3).
inter_hunk_context: usize--inter-hunk-context (default 0).
algorithm: DiffAlgorithmLine diff algorithm.
indent_heuristic: boolApply Git’s indent heuristic when generating hunks.
renames: RenameDetectionRename detection for tree diffs.
filter: Option<DiffFilter>--diff-filter status selection (applied after rename detection).
whitespace: WhitespaceModeWhitespace comparison rules for line diffs.
word_level_inline: boolWhen false, skip intra-line word emphasis (line-level hunks only).
function_context: boolExpand hunks to enclosing function boundaries (git diff -W).
Implementations§
Source§impl DiffOptions
impl DiffOptions
Sourcepub fn with_context_lines(self, context_lines: usize) -> Self
pub fn with_context_lines(self, context_lines: usize) -> Self
Builder-style update of context lines (-U).
Sourcepub fn with_inter_hunk_context(self, inter_hunk_context: usize) -> Self
pub fn with_inter_hunk_context(self, inter_hunk_context: usize) -> Self
Builder-style update of inter-hunk context.
Sourcepub fn with_algorithm(self, algorithm: DiffAlgorithm) -> Self
pub fn with_algorithm(self, algorithm: DiffAlgorithm) -> Self
Builder-style update of the line diff algorithm.
Sourcepub fn with_indent_heuristic(self, indent_heuristic: bool) -> Self
pub fn with_indent_heuristic(self, indent_heuristic: bool) -> Self
Builder-style update of the indent heuristic flag.
Sourcepub fn with_renames(self, renames: RenameDetection) -> Self
pub fn with_renames(self, renames: RenameDetection) -> Self
Builder-style update of rename detection.
Sourcepub fn with_filter(self, filter: Option<DiffFilter>) -> Self
pub fn with_filter(self, filter: Option<DiffFilter>) -> Self
Builder-style update of diff status filter.
Sourcepub fn rename_similarity_threshold(&self) -> Option<u32>
pub fn rename_similarity_threshold(&self) -> Option<u32>
Similarity percent for rename detection, or None when RenameDetection::Off.
Sourcepub fn rename_threshold_u32(&self) -> u32
pub fn rename_threshold_u32(&self) -> u32
u32 threshold for super::apply_rename_detection_to_diff_entries and related APIs.
Sourcepub fn with_word_level_inline(self, word_level_inline: bool) -> Self
pub fn with_word_level_inline(self, word_level_inline: bool) -> Self
Builder-style update of word-level inline emphasis.
Sourcepub fn with_whitespace(self, whitespace: WhitespaceMode) -> Self
pub fn with_whitespace(self, whitespace: WhitespaceMode) -> Self
Builder-style update of whitespace comparison rules.
Sourcepub fn cap_word_level_inline_for_changed_files(
self,
changed_files: usize,
) -> Self
pub fn cap_word_level_inline_for_changed_files( self, changed_files: usize, ) -> Self
Turn off word-level inline when changed_files exceeds
WORD_LEVEL_INLINE_MAX_CHANGED_FILES.
Sourcepub fn from_config(config: &ConfigSet) -> Self
pub fn from_config(config: &ConfigSet) -> Self
Read diff.algorithm, diff.context, diff.interHunkContext, diff.indentHeuristic,
and diff.renames from repository config.