pub enum Object {
Commit(Commit),
Tree(Tree),
Tag(Tag),
Blob(Blob),
}Expand description
A git object
This type encapsulates the four possible types of git object.
Variants§
Implementations§
Source§impl Object
impl Object
Sourcepub fn object_type(&self) -> ObjectType
pub fn object_type(&self) -> ObjectType
Get the object type as a plain (fieldless) enum.
Sourcepub fn commit(self) -> Result<Commit, UnexpectedObjectType>
pub fn commit(self) -> Result<Commit, UnexpectedObjectType>
Coerce the object to a Commit.
Returns Err if the object was not a commit.
Sourcepub fn tag(self) -> Result<Tag, UnexpectedObjectType>
pub fn tag(self) -> Result<Tag, UnexpectedObjectType>
Coerce the object to a Tag.
Returns Err if the object was not a tag.
Sourcepub fn tree(self) -> Result<Tree, UnexpectedObjectType>
pub fn tree(self) -> Result<Tree, UnexpectedObjectType>
Coerce the object to a Tree
Returns Err if the object was not a tree.
Sourcepub fn blob(self) -> Result<Blob, UnexpectedObjectType>
pub fn blob(self) -> Result<Blob, UnexpectedObjectType>
Coerce the object to a Blob
Returns Err if the object was not a blob.
Sourcepub async fn peel_to_commit<F: FileSystem>(
&self,
repo: &Repo<F>,
) -> GResult<Option<Commit>>
pub async fn peel_to_commit<F: FileSystem>( &self, repo: &Repo<F>, ) -> GResult<Option<Commit>>
Peel the object to a Commit, if possible.
Sourcepub async fn peel_to_tree<F: FileSystem>(
&self,
repo: &Repo<F>,
) -> GResult<Option<Tree>>
pub async fn peel_to_tree<F: FileSystem>( &self, repo: &Repo<F>, ) -> GResult<Option<Tree>>
Peel the object to a Tree, if possible.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Object
impl RefUnwindSafe for Object
impl Send for Object
impl Sync for Object
impl Unpin for Object
impl UnsafeUnpin for Object
impl UnwindSafe for Object
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