Struct gix_diff::blob::Driver

source ·
pub struct Driver {
    pub name: BString,
    pub command: Option<BString>,
    pub algorithm: Option<Algorithm>,
    pub binary_to_text_command: Option<BString>,
    pub is_binary: Option<bool>,
}
Available on crate feature blob only.
Expand description

A set of values to define how to diff something that is associated with it using git-attributes, relevant for regular files.

Some values are related to diffing, some are related to conversions.

Fields§

§name: BString

The name of the driver, as referred to by [diff "name"] in the git configuration.

§command: Option<BString>

The command to execute to perform the diff entirely like <command> old-file old-hex old-mode new-file new-hex new-mode.

Please note that we don’t make this call ourselves, but use it to determine that we should not run the our standard built-in algorithm but bail instead as the output of such a program isn’t standardized.

§algorithm: Option<Algorithm>

The per-driver algorithm to use.

§binary_to_text_command: Option<BString>

The external filter program to call like <binary_to_text_command> /path/to/blob which outputs a textual version of the provided binary file. Note that it’s invoked with a shell if arguments are given. Further, if present, it will always be executed, whether is_binary is set or not.

§is_binary: Option<bool>

Some(true) if this driver deals with binary files, which means that a binary_to_text_command should be used to convert binary into a textual representation. Without such a command, anything that is considered binary is not diffed, but only the size of its data is made available. If Some(false), it won’t be considered binary, and the its data will not be sampled for the null-byte either. Leaving it to None means binary detection is automatic, and is based on the presence of the 0 byte in the first 8kB of the buffer.

Implementations§

source§

impl Driver

source

pub fn prepare_binary_to_text_cmd(&self, path: &Path) -> Option<Command>

Produce an invocable command pre-configured to produce the filtered output on stdout after reading path.

Trait Implementations§

source§

impl Clone for Driver

source§

fn clone(&self) -> Driver

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for Driver

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Driver

source§

fn default() -> Driver

Returns the “default value” for a type. Read more
source§

impl PartialEq for Driver

source§

fn eq(&self, other: &Driver) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Driver

source§

impl StructuralEq for Driver

source§

impl StructuralPartialEq for Driver

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
§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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,

§

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>,

§

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>,

§

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.