pub struct PackIndex {
pub idx_path: PathBuf,
pub pack_path: PathBuf,
pub hash_bytes: usize,
pub entries: Vec<PackIndexEntry>,
pub fanout: [u32; 256],
}Expand description
Parsed data from a .idx file (version 2).
Fields§
§idx_path: PathBufAbsolute path to the .idx file.
pack_path: PathBufAbsolute path to the .pack file.
hash_bytes: usizeOID width in bytes (20 for SHA-1, 32 for SHA-256).
entries: Vec<PackIndexEntry>Parsed entries in index order (sorted by OID).
fanout: [u32; 256]256-entry first-byte fanout table: fanout[b] is the count of entries whose
first OID byte is <= b. Enables O(log n) lookup via the OID’s first byte
(matches Git’s find_pack_entry_one in packfile.c).
Implementations§
Source§impl PackIndex
impl PackIndex
Sourcepub fn find_offset(&self, oid: &ObjectId) -> Option<u64>
pub fn find_offset(&self, oid: &ObjectId) -> Option<u64>
Find the offset in the .pack file for the given SHA-1 OID via the fanout
table and binary search; returns None when the OID is not present.
Pack indexes containing SHA-256 OIDs are skipped here (callers handling
SHA-256 should branch on PackIndex::hash_bytes).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PackIndex
impl RefUnwindSafe for PackIndex
impl Send for PackIndex
impl Sync for PackIndex
impl Unpin for PackIndex
impl UnsafeUnpin for PackIndex
impl UnwindSafe for PackIndex
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
Mutably borrows from an owned value. Read more