pub struct Object<'repo> {
    pub id: ObjectId,
    pub kind: Kind,
    pub data: Vec<u8>,
    /* private fields */
}
Expand description

A decoded object with a reference to its owning repository.

Limitations

Note that it holds a reference to a buffer of it’s associated repository handle, so there can only be one at a time, per handle.

Fields

id: ObjectId

The id of the object

kind: Kind

The kind of the object

data: Vec<u8>

The fully decoded object data

Implementations

Follow tags to their target and commits to trees until the given kind of object is encountered.

Note that this object doesn’t necessarily have to be the end of the chain. Typical values are Kind::Commit or Kind::Tree.

Follow all tag object targets until a commit, tree or blob is reached.

Note that this method is different from peel_to_kind(…) as it won’t peel commits to their tree, but handles tags only.

Transform this object into a tree, or panic if it is none.

Transform this object into a commit, or panic if it is none.

Transform this object into a commit, or return it as part of the Err if it is no commit.

Transform this object into a tree, or return it as part of the Err if it is no tree.

Create an owned instance of this object, copying our data in the process.

Sever the connection to the Repository and turn this instance into a standalone object.

Obtain a fully parsed commit whose fields reference our data buffer,

Panic
  • this object is not a commit
  • the commit could not be decoded

Obtain a fully parsed commit whose fields reference our data buffer.

Obtain a an iterator over commit tokens like in to_commit_iter().

Panic
  • this object is not a commit

Obtain a commit token iterator from the data in this instance, if it is a commit.

Obtain a tag token iterator from the data in this instance.

Panic
  • this object is not a tag

Obtain a tag token iterator from the data in this instance.

Panic
  • this object is not a tag

Obtain a tag object from the data in this instance.

Panic
  • this object is not a tag
  • the tag could not be decoded

Obtain a fully parsed tag object whose fields reference our data buffer.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Encode the hex strict representing self into the result. Lower case letters are used (e.g. f9b4ca) Read more

Encode the hex strict representing self into the result. Upper case letters are used (e.g. F9B4CA) Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.