pub struct Tree {
pub root: RepoRoot,
pub roots: Vec<RepoPath>,
pub files: Vec<WalkedFile>,
pub dirs: Vec<WalkedDir>,
pub registered_count: usize,
/* private fields */
}Expand description
A Tree is the walked repository.
Fields§
§root: RepoRootThe repository root.
roots: Vec<RepoPath>The knowledge roots, in configuration order.
files: Vec<WalkedFile>Every walked file, ordered by path.
dirs: Vec<WalkedDir>Every directory under a root, including the roots, ordered by path.
registered_count: usizeThe number of registered roots, those of /.sokf/roots.d/, at the
end of roots.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn new(
root: RepoRoot,
roots: Vec<RepoPath>,
files: Vec<WalkedFile>,
dirs: Vec<WalkedDir>,
) -> Self
pub fn new( root: RepoRoot, roots: Vec<RepoPath>, files: Vec<WalkedFile>, dirs: Vec<WalkedDir>, ) -> Self
new builds a tree from its parts, and sorts the files and the
directories by path.
Sourcepub fn exists(&self, path: &RepoPath) -> bool
pub fn exists(&self, path: &RepoPath) -> bool
exists returns whether path exists on disk, and caches the
answer for the rest of the run. It asks the filesystem, not the
walked files, so that a link into an excluded tree still resolves.
Sourcepub fn is_dir(&self, path: &RepoPath) -> bool
pub fn is_dir(&self, path: &RepoPath) -> bool
is_dir returns whether path is a directory on disk, from the
same cache as exists.
Sourcepub fn on_disk(&self, path: &RepoPath) -> OnDisk
pub fn on_disk(&self, path: &RepoPath) -> OnDisk
on_disk returns what path names on disk, and caches the answer
for the rest of the run.
Sourcepub fn file(&self, path: &RepoPath) -> Option<&WalkedFile>
pub fn file(&self, path: &RepoPath) -> Option<&WalkedFile>
file returns the walked file at path, if any, by a binary search
over the sorted files.