gix_status/index_as_worktree/
recorder.rs1use bstr::BStr;
2use gix_index as index;
3
4use crate::index_as_worktree::{EntryStatus, VisitEntry};
5
6#[derive(Debug, Clone)]
10pub struct Record<'index, T, U> {
11 pub entry: &'index index::Entry,
13 pub entry_index: usize,
15 pub relative_path: &'index BStr,
17 pub status: EntryStatus<T, U>,
19}
20
21#[derive(Debug, Default)]
23pub struct Recorder<'index, T = (), U = ()> {
24 pub records: Vec<Record<'index, T, U>>,
26}
27
28impl<'index, T: Send, U: Send> VisitEntry<'index> for Recorder<'index, T, U> {
29 type ContentChange = T;
30 type SubmoduleStatus = U;
31
32 fn visit_entry(
33 &mut self,
34 _entries: &'index [index::Entry],
35 entry: &'index index::Entry,
36 entry_index: usize,
37 relative_path: &'index BStr,
38 status: EntryStatus<Self::ContentChange, Self::SubmoduleStatus>,
39 ) {
40 self.records.push(Record {
41 entry,
42 entry_index,
43 relative_path,
44 status,
45 });
46 }
47}