pub enum Header {
Commit,
Tree,
Blob,
Tag,
RefDelta {
base_id: ObjectId,
},
OfsDelta {
base_distance: u64,
},
}
Expand description
The header portion of a pack data entry, identifying the kind of stored object.
Variants§
Commit
The object is a commit
Tree
The object is a tree
Blob
The object is a blob
Tag
The object is a tag
RefDelta
Describes a delta-object which needs to be applied to a base. The base object is identified by the base_id
field
which is found within the parent repository.
Most commonly used for thin-packs when receiving pack files from the server to refer to objects that are not
part of the pack but expected to be present in the receivers repository.
§Note
This could also be an object within this pack if the LSB encoded offset would be larger than 20 bytes, which is unlikely to happen.
The naming is exactly the same as the canonical implementation uses, namely REF_DELTA.
OfsDelta
Describes a delta-object present in this pack which acts as base for this object.
The base object is measured as a distance from this objects
pack offset, so that base_pack_offset = this_objects_pack_offset - base_distance
§Note
The naming is exactly the same as the canonical implementation uses, namely OFS_DELTA.
Implementations§
source§impl Header
impl Header
sourcepub fn verified_base_pack_offset(
pack_offset: Offset,
distance: u64,
) -> Option<Offset>
pub fn verified_base_pack_offset( pack_offset: Offset, distance: u64, ) -> Option<Offset>
Subtract distance
from pack_offset
safely without the chance for overflow or no-ops if distance
is 0.
sourcepub fn as_kind(&self) -> Option<Kind>
pub fn as_kind(&self) -> Option<Kind>
Convert the header’s object kind into gix_object::Kind
if possible
sourcepub fn as_type_id(&self) -> u8
pub fn as_type_id(&self) -> u8
Convert this header’s object kind into the packs internal representation
source§impl Header
impl Header
sourcepub fn write_to(
&self,
decompressed_size_in_bytes: u64,
out: &mut dyn Write,
) -> Result<usize>
pub fn write_to( &self, decompressed_size_in_bytes: u64, out: &mut dyn Write, ) -> Result<usize>
Encode this header along the given decompressed_size_in_bytes
into the out
write stream for use within a data pack.
Returns the amount of bytes written to out
.
decompressed_size_in_bytes
is the full size in bytes of the object that this header represents
Trait Implementations§
source§impl<'de> Deserialize<'de> for Header
impl<'de> Deserialize<'de> for Header
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl Ord for Header
impl Ord for Header
source§impl PartialEq for Header
impl PartialEq for Header
source§impl PartialOrd for Header
impl PartialOrd for Header
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Header
impl Eq for Header
impl StructuralPartialEq for Header
Auto Trait Implementations§
impl Freeze for Header
impl RefUnwindSafe for Header
impl Send for Header
impl Sync for Header
impl Unpin for Header
impl UnwindSafe for Header
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)