1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use bstr::{BStr, ByteSlice};

use crate::{extension, Entry, State, Version};

impl State {
    pub fn version(&self) -> Version {
        self.version
    }

    pub fn entries(&self) -> &[Entry] {
        &self.entries
    }
    pub fn entries_mut(&mut self) -> &mut [Entry] {
        &mut self.entries
    }
    pub fn entries_mut_with_paths(&mut self) -> impl Iterator<Item = (&mut Entry, &BStr)> {
        let paths = &self.path_backing;
        self.entries.iter_mut().map(move |e| {
            let path = (&paths[e.path.clone()]).as_bstr();
            (e, path)
        })
    }
    pub fn tree(&self) -> Option<&extension::Tree> {
        self.tree.as_ref()
    }
    pub fn link(&self) -> Option<&extension::Link> {
        self.link.as_ref()
    }
    pub fn resolve_undo(&self) -> Option<&extension::resolve_undo::Paths> {
        self.resolve_undo.as_ref()
    }
    pub fn untracked(&self) -> Option<&extension::UntrackedCache> {
        self.untracked.as_ref()
    }
    pub fn fs_monitor(&self) -> Option<&extension::FsMonitor> {
        self.fs_monitor.as_ref()
    }
}