gix_filter

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

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

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

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.