pub struct DiffRenderer {
pub style: DiffStyle,
pub colors: DiffColors,
pub context_lines: usize,
pub show_line_numbers: bool,
pub terminal_width: Option<usize>,
pub use_box_drawing: bool,
}Expand description
Configuration for diff rendering.
Fields§
§style: DiffStyleRendering style.
colors: DiffColorsColor configuration.
context_lines: usizeNumber of context lines around changes.
show_line_numbers: boolWhether to show line numbers.
terminal_width: Option<usize>Terminal width (auto-detected if None).
use_box_drawing: boolWhether to use box drawing characters.
Implementations§
Source§impl DiffRenderer
impl DiffRenderer
Sourcepub fn with_style(self, style: DiffStyle) -> Self
pub fn with_style(self, style: DiffStyle) -> Self
Set the rendering style.
Sourcepub fn with_colors(self, colors: DiffColors) -> Self
pub fn with_colors(self, colors: DiffColors) -> Self
Set custom colors.
Sourcepub fn with_context(self, lines: usize) -> Self
pub fn with_context(self, lines: usize) -> Self
Set context lines.
Sourcepub fn with_line_numbers(self, show: bool) -> Self
pub fn with_line_numbers(self, show: bool) -> Self
Set whether to show line numbers.
Sourcepub fn with_width(self, width: usize) -> Self
pub fn with_width(self, width: usize) -> Self
Set terminal width.
Sourcepub fn render_text(&self, diff: &TextDiff<'_>) -> String
pub fn render_text(&self, diff: &TextDiff<'_>) -> String
Render a text diff to a colored string.
Sourcepub fn render_plain(&self, diff: &TextDiff<'_>) -> String
pub fn render_plain(&self, diff: &TextDiff<'_>) -> String
Render a text diff to plain text (no colors).
Sourcepub fn render_module(&self, diff: &ModuleDiff<'_>) -> String
pub fn render_module(&self, diff: &ModuleDiff<'_>) -> String
Render a module diff with all sections.
Sourcepub fn render_stats(&self, stats: &DiffStats) -> String
pub fn render_stats(&self, stats: &DiffStats) -> String
Render diff statistics.
Sourcepub fn render_score_change(&self, old_score: f64, new_score: f64) -> String
pub fn render_score_change(&self, old_score: f64, new_score: f64) -> String
Render a score change.
Sourcepub fn render_iteration_header(
&self,
from_iter: u32,
to_iter: u32,
old_score: f64,
new_score: f64,
) -> String
pub fn render_iteration_header( &self, from_iter: u32, to_iter: u32, old_score: f64, new_score: f64, ) -> String
Render an iteration header with score.
Sourcepub fn render_section_header(&self, title: &str) -> String
pub fn render_section_header(&self, title: &str) -> String
Render a section header.
Sourcepub fn render_box(&self, content: &str) -> String
pub fn render_box(&self, content: &str) -> String
Render a box around content.
Sourcepub fn added_style(&self) -> Style
pub fn added_style(&self) -> Style
Create a style for added content.
Sourcepub fn removed_style(&self) -> Style
pub fn removed_style(&self) -> Style
Create a style for removed content.
Sourcepub fn context_style(&self) -> Style
pub fn context_style(&self) -> Style
Create a style for context content.
Sourcepub fn header_style(&self) -> Style
pub fn header_style(&self) -> Style
Create a style for headers.
Trait Implementations§
Source§impl Clone for DiffRenderer
impl Clone for DiffRenderer
Source§fn clone(&self) -> DiffRenderer
fn clone(&self) -> DiffRenderer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DiffRenderer
impl Debug for DiffRenderer
Auto Trait Implementations§
impl Freeze for DiffRenderer
impl RefUnwindSafe for DiffRenderer
impl Send for DiffRenderer
impl Sync for DiffRenderer
impl Unpin for DiffRenderer
impl UnsafeUnpin for DiffRenderer
impl UnwindSafe for DiffRenderer
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more