pub struct Entry {
pub id: ObjectId,
pub kind: Kind,
pub decompressed_size: usize,
pub compressed_data: Vec<u8>,
}
generate
only.Expand description
An entry to be written to a file.
Some of these will be in-flight and in memory while waiting to be written. Memory requirements depend on the amount of compressed data they hold.
Fields§
§id: ObjectId
The hash of the object to write
kind: Kind
The kind of entry represented by data
. It’s used alongside with it to complete the pack entry
at rest or in transit.
decompressed_size: usize
The size in bytes needed once data
gets decompressed
compressed_data: Vec<u8>
The compressed data right behind the header
Implementations§
source§impl Entry
impl Entry
sourcepub fn invalid() -> Entry
pub fn invalid() -> Entry
An object which can be identified as invalid easily which happens if objects didn’t exist even if they were referred to.
sourcepub fn is_invalid(&self) -> bool
pub fn is_invalid(&self) -> bool
Returns true if this object doesn’t really exist but still has to be handled responsibly
Note that this is true for tree entries that are commits/git submodules, or for objects which aren’t present in our local clone due to shallow clones.
sourcepub fn from_pack_entry(
entry: Entry,
count: &Count,
potential_bases: &[Count],
bases_index_offset: usize,
pack_offset_to_oid: Option<impl FnMut(u32, u64) -> Option<ObjectId>>,
target_version: Version,
) -> Option<Result<Self, Error>>
pub fn from_pack_entry( entry: Entry, count: &Count, potential_bases: &[Count], bases_index_offset: usize, pack_offset_to_oid: Option<impl FnMut(u32, u64) -> Option<ObjectId>>, target_version: Version, ) -> Option<Result<Self, Error>>
Create an Entry from a previously counted object which is located in a pack. It’s entry
is provided here.
The version
specifies what kind of target Entry
version the caller desires.
sourcepub fn from_data(count: &Count, obj: &Data<'_>) -> Result<Self, Error>
pub fn from_data(count: &Count, obj: &Data<'_>) -> Result<Self, Error>
Create a new instance from the given oid
and its corresponding git object data obj
.
sourcepub fn to_entry_header(
&self,
version: Version,
index_to_base_distance: impl FnOnce(usize) -> u64,
) -> Header
pub fn to_entry_header( &self, version: Version, index_to_base_distance: impl FnOnce(usize) -> u64, ) -> Header
Transform ourselves into pack entry header of version
which can be written into a pack.
index_to_pack(object_index) -> pack_offset
is a function to convert the base object’s index into
the input object array (if each object is numbered) to an offset into the pack.
This information is known to the one calling the method.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
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 Entry
impl Ord for Entry
source§impl PartialEq for Entry
impl PartialEq for Entry
source§impl PartialOrd for Entry
impl PartialOrd for Entry
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 Eq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementations§
impl Freeze for Entry
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
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
)