Struct gix_config::file::includes::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> 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.