1use crate::tree::visit::Relation;
2use bstr::BStr;
3use gix_hash::ObjectId;
4use gix_object::bstr::BString;
5use std::collections::VecDeque;
6
7#[derive(Debug, thiserror::Error)]
9#[allow(missing_docs)]
10pub enum Error {
11 #[error(transparent)]
12 Find(#[from] gix_object::find::existing_iter::Error),
13 #[error("The delegate cancelled the operation")]
14 Cancelled,
15 #[error(transparent)]
16 EntriesDecode(#[from] gix_object::decode::Error),
17}
18
19pub trait Visit {
22 fn pop_front_tracked_path_and_set_current(&mut self);
24 fn push_back_tracked_path_component(&mut self, component: &BStr);
26 fn push_path_component(&mut self, component: &BStr);
28 fn pop_path_component(&mut self);
30 fn visit(&mut self, change: visit::Change) -> visit::Action;
34}
35
36#[derive(Default, Clone)]
38pub struct State {
39 pub buf1: Vec<u8>,
41 pub buf2: Vec<u8>,
43 trees: VecDeque<TreeInfoTuple>,
44 change_id: visit::ChangeId,
45}
46
47type TreeInfoTuple = (Option<ObjectId>, Option<ObjectId>, Option<Relation>);
48
49impl State {
50 fn clear(&mut self) {
51 self.trees.clear();
52 self.buf1.clear();
53 self.buf2.clear();
54 self.change_id = 0;
55 }
56}
57
58pub(super) mod function;
59
60pub mod visit;
62
63#[derive(Clone, Debug)]
65pub struct Recorder {
66 path_deque: VecDeque<BString>,
67 path: BString,
68 location: Option<recorder::Location>,
69 pub records: Vec<recorder::Change>,
71}
72
73pub mod recorder;