gix_pack/data/entry/
mod.rsuse crate::data::Entry;
const _TYPE_EXT1: u8 = 0;
const COMMIT: u8 = 1;
const TREE: u8 = 2;
const BLOB: u8 = 3;
const TAG: u8 = 4;
const _TYPE_EXT2: u8 = 5;
const OFS_DELTA: u8 = 6;
const REF_DELTA: u8 = 7;
#[derive(PartialEq, Eq, Debug, Hash, Ord, PartialOrd, Clone)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Location {
pub pack_id: u32,
pub entry_size: usize,
pub pack_offset: data::Offset,
}
impl Location {
pub fn entry_range(&self, pack_offset: data::Offset) -> crate::data::EntryRange {
pack_offset..pack_offset + self.entry_size as u64
}
}
impl Entry {
pub fn base_pack_offset(&self, distance: u64) -> data::Offset {
let pack_offset = self.data_offset - self.header_size() as u64;
pack_offset.checked_sub(distance).expect("in-bound distance of deltas")
}
pub fn pack_offset(&self) -> data::Offset {
self.data_offset - self.header_size() as u64
}
pub fn header_size(&self) -> usize {
self.header.size(self.decompressed_size)
}
}
pub mod decode;
mod header;
pub use header::Header;
use crate::data;