Skip to main content

IndexStatProbe

Struct IndexStatProbe 

Source
pub struct IndexStatProbe { /* private fields */ }
Expand description

Stage-0 index stat data that can prove a worktree path clean without re-reading and re-hashing it.

This is the public carrier for sley’s racy-git shortcut. Callers that already parsed .git/index can build a probe from the matching IndexEntry and the index file’s mtime, then pass it to worktree_entry_state or worktree_entry_state_by_git_path. The probe is trusted only when its path, mode, and object id match the expected entry and the cached stat is not racily clean; otherwise the helper falls back to the same content hashing path used by short_status_with_options.

Implementations§

Source§

impl IndexStatProbe

Source

pub fn from_index_entry( entry: IndexEntry, index_mtime: Option<(u64, u64)>, ) -> Self

Build a probe from a parsed stage-0 index entry and the index file’s mtime split as (seconds, nanoseconds).

Source

pub fn from_index_entry_and_index_path( entry: IndexEntry, index_path: impl AsRef<Path>, ) -> Self

Build a probe from a parsed index entry and the path of the index file on disk, using that file’s mtime as the racy-clean reference timestamp.

Source

pub fn from_repository_index( git_dir: impl AsRef<Path>, format: ObjectFormat, git_path: &[u8], ) -> Result<Option<Self>>

Read this repository’s index and return a probe for git_path when a stage-0 entry exists.

For repeated lookups prefer IndexStatProbeCache::from_repository_index and IndexStatProbeCache::probe_for_git_path. This one-shot helper keeps a small process-local cache for back-to-back calls against an unchanged index, but the explicit cache makes ownership and invalidation clearer for high-volume embedders.

Source

pub fn entry(&self) -> &IndexEntry

The parsed index entry this probe was built from.

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 IndexStatProbe

Source§

fn clone(&self) -> IndexStatProbe

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 IndexStatProbe

Source§

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

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

impl Eq for IndexStatProbe

Source§

impl PartialEq for IndexStatProbe

Source§

fn eq(&self, other: &IndexStatProbe) -> 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 IndexStatProbe

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.