pub struct IndexStatProbeCache { /* private fields */ }Expand description
Reusable stage-0 index stat probes for many worktree paths.
Prefer this over repeated IndexStatProbe::from_repository_index calls
when an embedder needs to verify many paths. It parses .git/index once,
records the index file mtime used for racy-git checks, and serves cheap
per-path probes from memory.
Implementations§
Source§impl IndexStatProbeCache
impl IndexStatProbeCache
Sourcepub fn from_index(index: &Index, index_mtime: Option<(u64, u64)>) -> Self
pub fn from_index(index: &Index, index_mtime: Option<(u64, u64)>) -> Self
Build a reusable probe cache from an already parsed index and index-file mtime.
Sourcepub fn from_repository_index(
git_dir: impl AsRef<Path>,
format: ObjectFormat,
) -> Result<Self>
pub fn from_repository_index( git_dir: impl AsRef<Path>, format: ObjectFormat, ) -> Result<Self>
Read this repository’s index once and build reusable stat probes.
A missing index returns an empty cache, matching the one-shot helper’s
Ok(None) result for every path.
Sourcepub fn probe_for_git_path(&self, git_path: &[u8]) -> Option<IndexStatProbe>
pub fn probe_for_git_path(&self, git_path: &[u8]) -> Option<IndexStatProbe>
Return a per-path probe for a stage-0 entry, if present.
Sourcepub fn contains_git_path(&self, git_path: &[u8]) -> bool
pub fn contains_git_path(&self, git_path: &[u8]) -> bool
Whether this cache has a stage-0 entry for git_path.
Sourcepub fn index_mtime(&self) -> Option<(u64, u64)>
pub fn index_mtime(&self) -> Option<(u64, u64)>
The index file mtime used as the racy-clean reference timestamp.
Trait Implementations§
Source§impl Clone for IndexStatProbeCache
impl Clone for IndexStatProbeCache
Source§fn clone(&self) -> IndexStatProbeCache
fn clone(&self) -> IndexStatProbeCache
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for IndexStatProbeCache
impl Debug for IndexStatProbeCache
Source§impl Default for IndexStatProbeCache
impl Default for IndexStatProbeCache
Source§fn default() -> IndexStatProbeCache
fn default() -> IndexStatProbeCache
Returns the “default value” for a type. Read more
impl Eq for IndexStatProbeCache
Source§impl PartialEq for IndexStatProbeCache
impl PartialEq for IndexStatProbeCache
Source§fn eq(&self, other: &IndexStatProbeCache) -> bool
fn eq(&self, other: &IndexStatProbeCache) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for IndexStatProbeCache
Auto Trait Implementations§
impl Freeze for IndexStatProbeCache
impl RefUnwindSafe for IndexStatProbeCache
impl Send for IndexStatProbeCache
impl Sync for IndexStatProbeCache
impl Unpin for IndexStatProbeCache
impl UnsafeUnpin for IndexStatProbeCache
impl UnwindSafe for IndexStatProbeCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more