Skip to main content

RenderColors

Struct RenderColors 

Source
pub struct RenderColors<'a> {
Show 15 fields pub frag: &'a str, pub func: &'a str, pub old: &'a str, pub new: &'a str, pub context: &'a str, pub reset: &'a str, pub whitespace: &'a str, pub old_moved: &'a str, pub old_moved_alt: &'a str, pub old_moved_dim: &'a str, pub old_moved_alt_dim: &'a str, pub new_moved: &'a str, pub new_moved_alt: &'a str, pub new_moved_dim: &'a str, pub new_moved_alt_dim: &'a str,
}
Expand description

ANSI color palette for a unified diff, mirroring git’s diff_get_color slots. Each field is the raw escape sequence (empty string = no color).

The renderer only consults the slots it paints in the hunk body; the per-file metainfo slot (meta) lives with the caller’s header emitter and is intentionally absent here.

Fields§

§frag: &'a str

color.diff.frag — the @@ .. @@ span.

§func: &'a str

color.diff.func — the section heading after the frag.

§old: &'a str

color.diff.old — removed (-) lines.

§new: &'a str

color.diff.new — added (+) lines.

§context: &'a str

color.diff.context — context ( ) lines and the no-newline marker.

§reset: &'a str

The reset sequence terminating each colored span.

§whitespace: &'a str

color.diff.whitespace — the highlight for whitespace errors (--ws-error-highlight).

§old_moved: &'a str

color.diff.oldMoved — removed lines detected as moved.

§old_moved_alt: &'a str

color.diff.oldMovedAlternative — alternate removed moved block.

§old_moved_dim: &'a str

color.diff.oldMovedDimmed — uninteresting removed moved line.

§old_moved_alt_dim: &'a str

color.diff.oldMovedAlternativeDimmed — alternate dimmed removed line.

§new_moved: &'a str

color.diff.newMoved — added lines detected as moved.

§new_moved_alt: &'a str

color.diff.newMovedAlternative — alternate added moved block.

§new_moved_dim: &'a str

color.diff.newMovedDimmed — uninteresting added moved line.

§new_moved_alt_dim: &'a str

color.diff.newMovedAlternativeDimmed — alternate dimmed added line.

Trait Implementations§

Source§

impl<'a> Clone for RenderColors<'a>

Source§

fn clone(&self) -> RenderColors<'a>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for RenderColors<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RenderColors<'a>

§

impl<'a> RefUnwindSafe for RenderColors<'a>

§

impl<'a> Send for RenderColors<'a>

§

impl<'a> Sync for RenderColors<'a>

§

impl<'a> Unpin for RenderColors<'a>

§

impl<'a> UnsafeUnpin for RenderColors<'a>

§

impl<'a> UnwindSafe for RenderColors<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.