gix_status/index_as_worktree/
recorder.rsuse bstr::BStr;
use gix_index as index;
use crate::index_as_worktree::{EntryStatus, VisitEntry};
#[derive(Debug, Clone)]
pub struct Record<'index, T, U> {
pub entry: &'index index::Entry,
pub entry_index: usize,
pub relative_path: &'index BStr,
pub status: EntryStatus<T, U>,
}
#[derive(Debug, Default)]
pub struct Recorder<'index, T = (), U = ()> {
pub records: Vec<Record<'index, T, U>>,
}
impl<'index, T: Send, U: Send> VisitEntry<'index> for Recorder<'index, T, U> {
type ContentChange = T;
type SubmoduleStatus = U;
fn visit_entry(
&mut self,
_entries: &'index [index::Entry],
entry: &'index index::Entry,
entry_index: usize,
relative_path: &'index BStr,
status: EntryStatus<Self::ContentChange, Self::SubmoduleStatus>,
) {
self.records.push(Record {
entry,
entry_index,
relative_path,
status,
});
}
}