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 UnsafeUnpin 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