Struct radicle_surf::fs::File
source · pub struct File { /* private fields */ }
Expand description
A File
in a git repository.
The representation is lightweight and contains the Oid
that
points to the git blob which is this file.
The name of a file can be retrieved via File::name
.
The FileContent
of a file can be retrieved via
File::content
.
Implementations§
source§impl File
impl File
sourcepub fn path(&self) -> PathBuf
pub fn path(&self) -> PathBuf
Return the exact path for this File
, 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 File
is located, relative to the
git repository root.
sourcepub fn content<'a>(&self, repo: &'a Repository) -> Result<FileContent<'a>, File>
pub fn content<'a>(&self, repo: &'a Repository) -> Result<FileContent<'a>, File>
Get the FileContent
for this File
.
§Errors
This function will fail if it could not find the git
blob
for the Oid
of this File
.
Trait Implementations§
impl Eq for File
impl StructuralPartialEq for File
Auto Trait Implementations§
impl Freeze for File
impl RefUnwindSafe for File
impl Send for File
impl Sync for File
impl Unpin for File
impl UnwindSafe for File
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
Mutably borrows from an owned value. Read more
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)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)