gix_config::file::includes

Struct Options

Source
pub struct Options<'a> {
    pub max_depth: u8,
    pub err_on_max_depth_exceeded: bool,
    pub err_on_interpolation_failure: bool,
    pub err_on_missing_config_path: bool,
    pub interpolate: Context<'a>,
    pub conditional: Context<'a>,
}
Expand description

Options to handle includes, like include.path or includeIf.<condition>.path,

Fields§

§max_depth: u8

The maximum allowed length of the file include chain built by following nested resolve_includes where base level is depth = 0.

§err_on_max_depth_exceeded: bool

When max depth is exceeded while following nested includes, return an error if true or silently stop following resolve_includes.

Setting this value to false allows to read configuration with cycles, which otherwise always results in an error.

§err_on_interpolation_failure: bool

If true, default false, failing to interpolate paths will result in an error.

Interpolation also happens if paths in conditional includes can’t be interpolated.

§err_on_missing_config_path: bool

If true, default true, configuration not originating from a path will cause errors when trying to resolve relative include paths (which would require the including configuration’s path).

§interpolate: Context<'a>

Used during path interpolation, both for include paths before trying to read the file, and for paths used in conditional gitdir includes.

§conditional: Context<'a>

Additional context for conditional includes to work.

Implementations§

Source§

impl<'a> Options<'a>

Source

pub fn no_follow() -> Self

Provide options to never follow include directives at all.

Source

pub fn follow(interpolate: Context<'a>, conditional: Context<'a>) -> Self

Provide options to follow includes like git does, provided the required conditional and interpolate contexts to support gitdir and onbranch based includeIf directives as well as standard include.path resolution. Note that the follow-mode is git-style, following at most 10 indirections while producing an error if the depth is exceeded.

Source

pub fn strict(self) -> Self

For use with follow type options, cause failure if an include path couldn’t be interpolated or the depth limit is exceeded.

Source

pub fn follow_without_conditional(home_dir: Option<&'a Path>) -> Self

Like follow, but without information to resolve includeIf directories as well as default configuration to allow resolving ~username/ path. home_dir is required to resolve ~/ paths if set. Note that %(prefix) paths cannot be interpolated with this configuration, use follow() instead for complete control.

Source

pub fn interpolate_with(self, context: Context<'a>) -> Self

Set the context used for interpolation when interpolating paths to include as well as the paths in gitdir conditional includes.

Trait Implementations§

Source§

impl<'a> Clone for Options<'a>

Source§

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

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 Options<'_>

Source§

fn default() -> Self

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

impl<'a> Copy for Options<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for Options<'a>

§

impl<'a> RefUnwindSafe for Options<'a>

§

impl<'a> Send for Options<'a>

§

impl<'a> Sync for Options<'a>

§

impl<'a> Unpin for Options<'a>

§

impl<'a> UnwindSafe for Options<'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, 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.