Struct gix::AttributeStack

source ·
pub struct AttributeStack<'repo> { /* private fields */ }
Available on (crate features excludes or attributes) and (crate features attributes or excludes) 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>, is_dir: Option<bool> ) -> Result<Platform<'_>>

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 is_dir is known with Some(…), 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.

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>, is_dir: Option<bool> ) -> Result<Platform<'_>>

Available on crate feature excludes only.

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

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

Panics
  • on illformed UTF8 in relative

Methods from Deref<Target = Stack>§

source

pub fn at_path<Find, E>( &mut self, relative: impl AsRef<Path>, is_dir: Option<bool>, find: Find ) -> Result<Platform<'_>, Error>where Find: for<'a> FnMut(&oid, &'a mut Vec<u8, Global>) -> Result<BlobRef<'a>, E>, E: Error + Send + Sync + 'static,

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 is_dir is known with Some(…), 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. find 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, Find, E>( &mut self, relative: impl Into<&'r BStr>, is_dir: Option<bool>, find: Find ) -> Result<Platform<'_>, Error>where Find: for<'a> FnMut(&oid, &'a mut Vec<u8, Global>) -> Result<BlobRef<'a>, E>, E: Error + Send + Sync + 'static,

Available on crate feature excludes only.

Obtain a platform for lookups from a repo-relative path, typically obtained from an index entry. is_dir should reflect whether it’s a directory or not, or left at None if unknown. find maybe used to lookup objects from an id mapping. All effects are similar to at_path().

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

Panics

on illformed UTF8 in relative

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> !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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

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

Initializes a with the given initializer. Read more
§

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

Dereferences the given pointer. Read more
§

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

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

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

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.