pub enum Object {
Blob(Blob),
Tree(Tree),
Commit(Commit),
}Expand description
A unified enum representing any Git object type.
This enum allows handling different Git object types uniformly while still providing type-safe access to specific object data.
Variants§
Blob(Blob)
A blob object containing file content.
Tree(Tree)
A tree object containing directory entries.
Commit(Commit)
A commit object containing commit metadata.
Implementations§
Source§impl Object
impl Object
Sourcepub fn kind(&self) -> ObjectType
pub fn kind(&self) -> ObjectType
Returns the type of this object.
Sourcepub fn as_blob(&self) -> Option<&Blob>
pub fn as_blob(&self) -> Option<&Blob>
Returns a reference to the inner Blob if this is a Blob object.
Sourcepub fn as_tree(&self) -> Option<&Tree>
pub fn as_tree(&self) -> Option<&Tree>
Returns a reference to the inner Tree if this is a Tree object.
Sourcepub fn as_commit(&self) -> Option<&Commit>
pub fn as_commit(&self) -> Option<&Commit>
Returns a reference to the inner Commit if this is a Commit object.
Sourcepub fn into_blob(self) -> Option<Blob>
pub fn into_blob(self) -> Option<Blob>
Consumes this Object and returns the inner Blob if this is a Blob object.
Sourcepub fn into_tree(self) -> Option<Tree>
pub fn into_tree(self) -> Option<Tree>
Consumes this Object and returns the inner Tree if this is a Tree object.
Sourcepub fn into_commit(self) -> Option<Commit>
pub fn into_commit(self) -> Option<Commit>
Consumes this Object and returns the inner Commit if this is a Commit object.
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 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