Struct gix::AttributeStack
source · pub struct AttributeStack<'repo> { /* private fields */ }
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>
impl<'repo> AttributeStack<'repo>
Lifecycle
sourcepub fn new(stack: Stack, repo: &'repo Repository) -> Self
Available on crate feature excludes
only.
pub fn new(stack: Stack, repo: &'repo Repository) -> Self
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§impl<'repo> AttributeStack<'repo>
impl<'repo> AttributeStack<'repo>
Platform retrieval
sourcepub fn at_path(
&mut self,
relative: impl AsRef<Path>,
is_dir: Option<bool>
) -> Result<Platform<'_>>
Available on crate feature excludes
only.
pub fn at_path( &mut self, relative: impl AsRef<Path>, is_dir: Option<bool> ) -> Result<Platform<'_>>
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.
sourcepub fn at_entry<'r>(
&mut self,
relative: impl Into<&'r BStr>,
is_dir: Option<bool>
) -> Result<Platform<'_>>
Available on crate feature excludes
only.
pub fn at_entry<'r>( &mut self, relative: impl Into<&'r BStr>, is_dir: Option<bool> ) -> Result<Platform<'_>>
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>§
sourcepub 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.
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,
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.
sourcepub 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.
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,
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
sourcepub fn take_statistics(&mut self) -> Statistics
Available on crate feature excludes
only.
pub fn take_statistics(&mut self) -> Statistics
excludes
only.Reset the statistics after returning them.
sourcepub fn state_mut(&mut self) -> &mut State
Available on crate feature excludes
only.
pub fn state_mut(&mut self) -> &mut State
excludes
only.Return our state for applying changes.
sourcepub fn set_case(&mut self, case: Case) -> &mut Stack
Available on crate feature excludes
only.
pub fn set_case(&mut self, case: Case) -> &mut Stack
excludes
only.Change the case
of the next match to the given one.
sourcepub fn statistics(&self) -> &Statistics
Available on crate feature excludes
only.
pub fn statistics(&self) -> &Statistics
excludes
only.Return the statistics we gathered thus far.
sourcepub fn state(&self) -> &State
Available on crate feature excludes
only.
pub fn state(&self) -> &State
excludes
only.Return the state for introspection.
sourcepub fn base(&self) -> &Path
Available on crate feature excludes
only.
pub fn base(&self) -> &Path
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.
sourcepub fn attribute_matches(&self) -> Outcome
Available on crate feature excludes
only.
pub fn attribute_matches(&self) -> Outcome
excludes
only.Creates a new container to store match outcomes for all attribute matches.
Panics
If attributes aren’t configured.
sourcepub fn selected_attribute_matches<'a>(
&self,
given: impl IntoIterator<Item = impl Into<&'a str>>
) -> Outcome
Available on crate feature excludes
only.
pub fn selected_attribute_matches<'a>( &self, given: impl IntoIterator<Item = impl Into<&'a str>> ) -> Outcome
excludes
only.Creates a new container to store match outcomes for the given attributes.
Panics
If attributes aren’t configured.
sourcepub fn attributes_collection(&self) -> &MetadataCollection
Available on crate feature excludes
only.
pub fn attributes_collection(&self) -> &MetadataCollection
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.
impl Deref for AttributeStack<'_>
excludes
only.