Struct git_odb::data::Object[][src]

pub struct Object<'a> {
    pub kind: Kind,
    pub data: &'a [u8],
    // some fields omitted
}

A borrowed object using a borrowed slice as backing buffer.

Fields

kind: Kind

kind of object

data: &'a [u8]

decoded, decompressed data, owned by a backing store.

Implementations

impl Object<'_>[src]

pub fn verify_checksum(&self, desired: impl AsRef<oid>) -> Result<(), Error>[src]

Compute the checksum of self and compare it with the desired hash. If the hashes do not match, an Error is returned, containing the actual hash of self.

impl<'a> Object<'a>[src]

pub fn new(kind: Kind, data: &'a [u8]) -> Object<'a>[src]

Constructs a new data object from kind and data.

pub fn decode(&self) -> Result<Object<'a>, Error>[src]

Decodes the data in the backing slice into a git_object::immutable::Object, allowing to access all of its data conveniently. The cost of parsing an object is negligible.

Note that mutable, decoded objects can be created from a crate::data::Object using git_object::immutable::Object::into_mutable().

pub fn into_tree_iter(self) -> Option<TreeIter<'a>>[src]

Returns this object as tree iterator to parse entries one at a time to avoid allocations, or None if this is not a tree object.

pub fn into_commit_iter(self) -> Option<CommitIter<'a>>[src]

Returns this object as commit iterator to parse tokens one at a time to avoid allocations, or None if this is not a commit object.

Trait Implementations

impl<'a> Clone for Object<'a>[src]

impl<'a> Debug for Object<'a>[src]

impl<'a> Eq for Object<'a>[src]

impl<'a> Hash for Object<'a>[src]

impl<'a> Ord for Object<'a>[src]

impl<'a> PartialEq<Object<'a>> for Object<'a>[src]

impl<'a> PartialOrd<Object<'a>> for Object<'a>[src]

impl<'a> StructuralEq for Object<'a>[src]

impl<'a> StructuralPartialEq for Object<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for Object<'a>

impl<'a> Send for Object<'a>

impl<'a> Sync for Object<'a>

impl<'a> Unpin for Object<'a>

impl<'a> UnwindSafe for Object<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> CallHasher for T where
    T: Hash

impl<T> Conv for T

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pipe for T where
    T: ?Sized

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T> Tap for T

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

impl<T> TryConv for T

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,