Struct gix::AttributeStack

source ·
pub struct AttributeStack<'repo> { /* private fields */ }
Available on crate features excludes or attributes only.
Expand description

A utility to access .gitattributes and .gitignore information efficiently.

Implementations§

source§

impl<'repo> AttributeStack<'repo>

Lifecycle

source

pub fn new(stack: Stack, repo: &'repo Repository) -> Self

Available on crate feature excludes only.

Create a new instance from a repo and the underlying pre-configured stack.

Note that this type is typically created by Repository::attributes() or Repository::attributes_only().

source

pub fn detach(self) -> Stack

Available on crate feature excludes only.

Detach the repository and return the underlying plumbing datatype.

source§

impl<'repo> AttributeStack<'repo>

Platform retrieval

source

pub fn at_path( &mut self, relative: impl AsRef<Path>, mode: Option<Mode> ) -> Result<Platform<'_>>

Available on crate feature excludes only.

Append the relative path to the root directory of the cache and load all attribute or ignore files on the way as needed. Use mode to specify what kind of item lives at relative - directories may match against rules specifically. If mode is None, the item at relative is assumed to be a file.

The returned platform may be used to access the actual attribute or ignore information.

source

pub fn at_entry<'r>( &mut self, relative: impl Into<&'r BStr>, mode: Option<Mode> ) -> Result<Platform<'_>>

Available on crate feature excludes only.

Obtain a platform for attribute or ignore lookups from a repo-relative path, typically obtained from an index entry. mode should reflect whether it’s a directory or not, or left at None if unknown.

If relative ends with / and mode is None, it is automatically assumed to be a directory.

Methods from Deref<Target = Stack>§

source

pub fn at_path( &mut self, relative: impl AsRef<Path>, mode: Option<Mode>, objects: &dyn Find ) -> Result<Platform<'_>, Error>

Available on crate feature excludes only.

Append the relative path to the root directory of the cache and efficiently create leading directories, while assuring that no symlinks are in that path. Unless mode is known with Some(gix_index::entry::Mode::DIR|COMMIT), then relative points to a directory itself in which case the entire resulting path is created as directory. If it’s not known it is assumed to be a file. objects maybe used to lookup objects from an id mapping, with mappnigs

Provide access to cached information for that relative path via the returned platform.

source

pub fn at_entry<'r>( &mut self, relative: impl Into<&'r BStr>, mode: Option<Mode>, objects: &dyn Find ) -> Result<Platform<'_>, Error>

Available on crate feature excludes only.

Obtain a platform for lookups from a repo-relative path, typically obtained from an index entry. mode should reflect the kind of item set here, or left at None if unknown. objects maybe used to lookup objects from an id mapping. All effects are similar to at_path().

If relative ends with / and mode is None, it is automatically assumed set to be a directory.

source

pub fn take_statistics(&mut self) -> Statistics

Available on crate feature excludes only.

Reset the statistics after returning them.

source

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

Available on crate feature excludes only.

Return our state for applying changes.

source

pub fn set_case(&mut self, case: Case) -> &mut Stack

Available on crate feature excludes only.

Change the case of the next match to the given one.

source

pub fn statistics(&self) -> &Statistics

Available on crate feature excludes only.

Return the statistics we gathered thus far.

source

pub fn state(&self) -> &State

Available on crate feature excludes only.

Return the state for introspection.

source

pub fn base(&self) -> &Path

Available on crate feature excludes only.

Return the base path against which all entries or paths should be relative to when querying.

Note that this path may not be canonicalized.

source

pub fn attribute_matches(&self) -> Outcome

Available on crate feature excludes only.

Creates a new container to store match outcomes for all attribute matches.

§Panics

If attributes aren’t configured.

source

pub fn selected_attribute_matches<'a>( &self, given: impl IntoIterator<Item = impl Into<&'a str>> ) -> Outcome

Available on crate feature excludes only.

Creates a new container to store match outcomes for the given attributes.

§Panics

If attributes aren’t configured.

source

pub fn attributes_collection(&self) -> &MetadataCollection

Available on crate feature excludes only.

Return the metadata collection that enables initializing attribute match outcomes as done in attribute_matches() or selected_attribute_matches()

§Panics

If attributes aren’t configured.

Trait Implementations§

source§

impl Deref for AttributeStack<'_>

Available on crate feature excludes only.
§

type Target = Stack

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl DerefMut for AttributeStack<'_>

Available on crate feature excludes only.
source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.

Auto Trait Implementations§

§

impl<'repo> Freeze for AttributeStack<'repo>

§

impl<'repo> !RefUnwindSafe for AttributeStack<'repo>

§

impl<'repo> !Send for AttributeStack<'repo>

§

impl<'repo> !Sync for AttributeStack<'repo>

§

impl<'repo> Unpin for AttributeStack<'repo>

§

impl<'repo> !UnwindSafe for AttributeStack<'repo>

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> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
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.