Struct git_repository::index::File
source · [−]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
Methods from Deref<Target = State>
sourcepub fn version(&self) -> Version
pub fn version(&self) -> Version
Return the version used to store this state’s information on disk.
sourcepub fn path_backing(&self) -> &Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn path_backing(&self) -> &Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Return our path backing, the place which keeps all paths one after another, with entries storing only the range to access them.
sourcepub fn take_path_backing(&mut self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
pub fn take_path_backing(&mut self) -> Vec<u8, Global>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
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.
sourcepub fn return_path_backing(&mut self, backing: Vec<u8, Global>)
pub fn return_path_backing(&mut self, backing: Vec<u8, Global>)
After usage of the storage obtained by take_path_backing()
, return it here.
Note that it must not be empty.
sourcepub fn entries_with_paths_by_filter_map<'a, T>(
&'a self,
filter_map: impl FnMut(&'a BStr, &Entry) -> Option<T> + 'a
) -> impl Iterator<Item = (&'a BStr, T)> + 'a
pub fn entries_with_paths_by_filter_map<'a, T>(
&'a self,
filter_map: impl FnMut(&'a BStr, &Entry) -> Option<T> + 'a
) -> impl Iterator<Item = (&'a BStr, T)> + 'a
Runs filter_map
on all entries, returning an iterator over all paths along with the result of filter_map
.
sourcepub fn entries_mut(&mut self) -> &mut [Entry]
pub fn entries_mut(&mut self) -> &mut [Entry]
Return mutable entries in a slice.
sourcepub fn entries_mut_with_paths(
&mut self
) -> impl Iterator<Item = (&mut Entry, &BStr)>
pub fn entries_mut_with_paths(
&mut self
) -> impl Iterator<Item = (&mut Entry, &BStr)>
Return mutable entries along with their paths in an iterator.
sourcepub fn entries_mut_with_paths_in(
&'state mut self,
backing: &'backing Vec<u8, Global>
) -> impl Iterator<Item = (&'state mut Entry, &'backing BStr)>
pub fn entries_mut_with_paths_in(
&'state mut self,
backing: &'backing Vec<u8, Global>
) -> impl Iterator<Item = (&'state mut Entry, &'backing BStr)>
Return mutable entries along with their path, as obtained from backing
.
sourcepub fn entry_index_by_path_and_stage(
&self,
path: &BStr,
stage: u32
) -> Option<usize>
pub fn entry_index_by_path_and_stage(
&self,
path: &BStr,
stage: u32
) -> Option<usize>
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.
sourcepub fn entry_by_path_and_stage(&self, path: &BStr, stage: u32) -> Option<&Entry>
pub fn entry_by_path_and_stage(&self, path: &BStr, stage: u32) -> Option<&Entry>
Like entry_index_by_path_and_stage()
,
but returns the entry instead of the index.
sourcepub fn entry(&self, idx: usize) -> &Entry
pub fn entry(&self, idx: usize) -> &Entry
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().
sourcepub fn resolve_undo(&self) -> Option<&Vec<ResolvePath, Global>>
pub fn resolve_undo(&self) -> Option<&Vec<ResolvePath, Global>>
Obtain the resolve-undo extension.
sourcepub fn untracked(&self) -> Option<&UntrackedCache>
pub fn untracked(&self) -> Option<&UntrackedCache>
Obtain the untracked extension.
sourcepub fn fs_monitor(&self) -> Option<&FsMonitor>
pub fn fs_monitor(&self) -> Option<&FsMonitor>
Obtain the fsmonitor extension.
sourcepub fn verify_entries(&self) -> Result<(), Error>
pub fn verify_entries(&self) -> Result<(), Error>
Assure our entries are consistent.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more