Struct radicle_surf::fs::Directory
source · pub struct Directory { /* private fields */ }
Expand description
A Directory
is the representation of a file system directory, for a given
git
tree.
The name of a directory can be retrieved via File::name
.
The Entries
of a directory can be retrieved via
Directory::entries
.
Implementations§
source§impl Directory
impl Directory
sourcepub fn path(&self) -> PathBuf
pub fn path(&self) -> PathBuf
Return the exact path for this Directory
, including the name
of the
directory itself.
The path is relative to the git repository root.
sourcepub fn location(&self) -> &Path
pub fn location(&self) -> &Path
Return the Path
where this Directory
is located, relative to the
git repository root.
sourcepub fn entries(&self, repo: &Repository) -> Result<Entries, Directory>
pub fn entries(&self, repo: &Repository) -> Result<Entries, Directory>
sourcepub fn find_entry<P>(
&self,
path: &P,
repo: &Repository,
) -> Result<Entry, Directory>
pub fn find_entry<P>( &self, path: &P, repo: &Repository, ) -> Result<Entry, Directory>
Find the Entry
found at a non-empty path
, if it exists.
sourcepub fn find_file<P>(
&self,
path: &P,
repo: &Repository,
) -> Result<File, Directory>
pub fn find_file<P>( &self, path: &P, repo: &Repository, ) -> Result<File, Directory>
Find the Oid
, for a File
, found at path
, if it exists.
sourcepub fn find_directory<P>(
&self,
path: &P,
repo: &Repository,
) -> Result<Self, Directory>
pub fn find_directory<P>( &self, path: &P, repo: &Repository, ) -> Result<Self, Directory>
Find the Directory
found at path
, if it exists.
If path
is ROOT_DIR
(i.e. an empty path), returns self.
sourcepub fn size(&self, repo: &Repository) -> Result<usize, Directory>
pub fn size(&self, repo: &Repository) -> Result<usize, Directory>
Get the total size, in bytes, of a Directory
. The size is
the sum of all files that can be reached from this Directory
.
sourcepub fn traverse<Error, B, F>(
&self,
repo: &Repository,
initial: B,
f: &mut F,
) -> Result<B, Error>
pub fn traverse<Error, B, F>( &self, repo: &Repository, initial: B, f: &mut F, ) -> Result<B, Error>
Traverse the entire Directory
using the initial
accumulator and the function f
.
For each Entry::Directory
this will recursively call
Directory::traverse
and obtain its Entries
.
Error
is the error type of the fallible function.
B
is the type of the accumulator.
F
is the fallible function that takes the accumulator and
the next Entry
, possibly providing the next accumulator
value.
Trait Implementations§
impl Eq for Directory
impl StructuralPartialEq for Directory
Auto Trait Implementations§
impl Freeze for Directory
impl RefUnwindSafe for Directory
impl Send for Directory
impl Sync for Directory
impl Unpin for Directory
impl UnwindSafe for Directory
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)