PackIndex

Struct PackIndex 

Source
pub struct PackIndex {
    pub version: u32,
    pub fan_out: [u32; 256],
    pub object_names: Vec<[u8; 20]>,
    pub crc32_checksums: Vec<u32>,
    pub offsets: Vec<u32>,
    pub large_offsets: Option<Vec<u64>>,
    pub pack_checksum: [u8; 20],
    pub index_checksum: [u8; 20],
    pub raw_data: Vec<u8>,
}
Expand description

Represents a Git pack index file (.idx)

Pack index files provide efficient lookup into pack files by mapping object SHA-1 hashes to their byte offsets within the corresponding pack file.

Fields§

§version: u32

Index file format version (should be 2)

§fan_out: [u32; 256]

Fan-out table: 256 entries indicating object count for each first byte

§object_names: Vec<[u8; 20]>

Sorted array of 20-byte SHA-1 object names

§crc32_checksums: Vec<u32>

CRC32 checksums for packed object data (for integrity verification)

§offsets: Vec<u32>

4-byte offsets into the pack file for each object

§large_offsets: Option<Vec<u64>>

Optional 8-byte offsets for large pack files (when 4-byte offset has MSB set)

§pack_checksum: [u8; 20]

SHA-1 checksum of the corresponding pack file

§index_checksum: [u8; 20]

SHA-1 checksum of all the index data above

§raw_data: Vec<u8>

Raw data for debugging/display purposes

Implementations§

Source§

impl PackIndex

Source

pub fn parse(input: &[u8]) -> IResult<&[u8], Self>

Parse a pack index file from raw bytes

Source

pub fn object_count(&self) -> usize

Get the total number of objects in this index

Source

pub fn lookup_object(&self, sha1: &[u8; 20]) -> Option<u64>

Look up an object by its SHA-1 hash Returns the offset in the pack file if found

Source

pub fn get_object_offset(&self, index: usize) -> u64

Get the pack file offset for an object at the given index

Source

pub fn get_object_crc32(&self, index: usize) -> Option<u32>

Get the CRC32 checksum for an object at the given index

Source

pub fn verify_checksum(&self) -> Result<(), PackError>

Verify the integrity of the index file

Trait Implementations§

Source§

impl Clone for PackIndex

Source§

fn clone(&self) -> PackIndex

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PackIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for PackIndex

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToCompactString for T
where T: Display,

Source§

impl<T> ToLine for T
where T: Display,

Source§

fn to_line(&self) -> Line<'_>

Converts the value to a Line.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToSpan for T
where T: Display,

Source§

fn to_span(&self) -> Span<'_>

Converts the value to a Span.
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T> ToText for T
where T: Display,

Source§

fn to_text(&self) -> Text<'_>

Converts the value to a Text.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.