pub struct Entry {
pub id: ObjectId,
pub kind: Kind,
pub decompressed_size: usize,
pub compressed_data: Vec<u8>,
}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: ObjectIdThe hash of the object to write
kind: KindThe kind of entry represented by data. It’s used alongside with it to complete the pack entry
at rest or in transit.
decompressed_size: usizeThe size in bytes needed once data gets decompressed
compressed_data: Vec<u8>The compressed data right behind the header
Implementations
sourceimpl 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.
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
sourceimpl<'de> Deserialize<'de> for Entry
impl<'de> Deserialize<'de> for Entry
sourcefn 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>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl Ord for Entry
impl Ord for Entry
sourceimpl PartialOrd<Entry> for Entry
impl PartialOrd<Entry> for Entry
sourcefn partial_cmp(&self, other: &Entry) -> Option<Ordering>
fn partial_cmp(&self, other: &Entry) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl Eq for Entry
impl StructuralEq for Entry
impl StructuralPartialEq for Entry
Auto Trait Implementations
impl RefUnwindSafe for Entry
impl Send for Entry
impl Sync for Entry
impl Unpin for Entry
impl UnwindSafe for Entry
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more