pub struct File {
    pub state: State,
    pub path: PathBuf,
    pub checksum: ObjectId,
}
Expand description

An index file whose state was read from a file on disk.

Fields

state: State

The state containing the actual index data.

path: PathBuf

The path from which the index was read or to which it is supposed to be written.

checksum: ObjectId

The checksum of all bytes prior to the checksum itself.

Implementations

Initialization

Open an index file at path with options.

Verify the integrity of the index to assure its consistency.

Write the index to out with options, to be readable by File::at(), returning the version that was actually written to retain all information of this index.

Methods from Deref<Target = State>

Return the version used to store this state’s information on disk.

Return our entries

Return our path backing, the place which keeps all paths one after another, with entries storing only the range to access them.

Sometimes it’s needed to remove the path backing to allow certain mutation to happen in the state while supporting reading the entry’s path.

After usage of the storage obtained by take_path_backing(), return it here. Note that it must not be empty.

Runs filter_map on all entries, returning an iterator over all paths along with the result of filter_map.

Return mutable entries in a slice.

Return mutable entries along with their paths in an iterator.

Return mutable entries along with their path, as obtained from backing.

Find the entry index in entries() matching the given repository-relative path and stage, or None.

Use the index for accessing multiple stages if they exists, but at least the single matching entry.

Like entry_index_by_path_and_stage(), but returns the entry instead of the index.

Return the entry at idx or panic if the index is out of bounds.

The idx is typically returned by entry_by_path_and_stage().

Access the tree extension.

Access the link extension.

Obtain the resolve-undo extension.

Obtain the untracked extension.

Obtain the fsmonitor extension.

Assure our entries are consistent.

Note: find cannot be Option<F> as we can’t call it with a closure then due to the indirection through Some.

Serialize this instance to out with options.

Trait Implementations

Formats the value using the given formatter. Read more

The resulting type after dereferencing.

Dereferences the value.

Mutably dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

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

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.