Skip to main content

IndexStatProbeCache

Struct IndexStatProbeCache 

Source
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

Source

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.

Source

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.

Source

pub fn probe_for_git_path(&self, git_path: &[u8]) -> Option<IndexStatProbe>

Return a per-path probe for a stage-0 entry, if present.

Source

pub fn contains_git_path(&self, git_path: &[u8]) -> bool

Whether this cache has a stage-0 entry for git_path.

Source

pub fn len(&self) -> usize

Number of stage-0 entries in the cache.

Source

pub fn is_empty(&self) -> bool

Whether the cache has no stage-0 entries.

Source

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

Source§

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)

Performs copy-assignment from source. Read more
Source§

impl Debug for IndexStatProbeCache

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for IndexStatProbeCache

Source§

fn default() -> IndexStatProbeCache

Returns the “default value” for a type. Read more
Source§

impl Eq for IndexStatProbeCache

Source§

impl PartialEq for IndexStatProbeCache

Source§

fn eq(&self, other: &IndexStatProbeCache) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for IndexStatProbeCache

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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,

Source§

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>,

Source§

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>,

Source§

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.