Struct gix_filter::Pipeline

source ·
pub struct Pipeline { /* private fields */ }
Expand description

The standard git filter pipeline comprised of multiple standard filters and support for external filters.

It’s configuring itself for each provided path based on the path’s attributes, implementing the complex logic that governs it.

Implementations§

source§

impl Pipeline

Access

source

pub fn convert_to_git<R>( &mut self, src: R, rela_path: &Path, attributes: &mut dyn FnMut(&BStr, &mut Outcome), index_object: &mut IndexObjectFn<'_>, ) -> Result<ToGitOutcome<'_, R>, Error>
where R: Read,

Convert a src stream (to be found at rela_path) to a representation suitable for storage in git based on the attributes at rela_path which is passed as first argument.. When converting to crlf, and depending on the configuration, index_object might be called to obtain the index version of src if available. It can return Ok(None) if this information isn’t available.

source

pub fn convert_to_worktree<'input>( &mut self, src: &'input [u8], rela_path: &BStr, attributes: &mut dyn FnMut(&BStr, &mut Outcome), can_delay: Delay, ) -> Result<ToWorktreeOutcome<'input, '_>, Error>

Convert a src buffer located at rela_path (in the index) from what’s in git to the worktree representation, asking for attributes with rela_path as first argument to configure the operation automatically. can_delay defines if long-running processes can delay their response, and if they choose to the caller has to specifically deal with it by interacting with the driver_state directly.

The reason src is a buffer is to indicate that git generally doesn’t do well streaming data, so it should be small enough to be performant while being held in memory. This is typically the case, especially if git-lfs is used as intended.

source§

impl Pipeline

Lifecycle

source

pub fn new(context: Context, options: Options) -> Self

Create a new pipeline with configured drivers (which should be considered safe to invoke), which are passed context. eol_config serves as fallback to understand how to convert line endings if no line-ending attributes are present. crlf_roundtrip_check corresponds to the git-configuration of core.safecrlf. object_hash is relevant for the ident filter.

source

pub fn into_driver_state(self) -> State

Turn ourselves into state managing possibly running driver processes.

This can be used to control how these are terminated via driver::State::shutdown().

source§

impl Pipeline

Access

source

pub fn driver_state_mut(&mut self) -> &mut State

Return a mutable reference to the state that handles long running processes. Interacting with it directly allows to handle delayed results.

source

pub fn driver_context_mut(&mut self) -> &mut Context

Provide mutable context that is made available to the process filters.

The context set here is relevant for the convert_to_git() and convert_to_worktree() methods.

source

pub fn options_mut(&mut self) -> &mut Options

Return a set of options for configuration after instantiation.

source

pub fn buffers_mut(&mut self) -> &mut Buffers

Return our double-buffers for reuse by the caller.

Trait Implementations§

source§

impl Clone for Pipeline

source§

fn clone(&self) -> Pipeline

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 Default for Pipeline

source§

fn default() -> Self

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

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
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.