pub struct PackReader { /* private fields */ }Expand description
Pack reader for extracting objects.
Implementations§
Source§impl PackReader
impl PackReader
pub fn from_bytes(pack_data: Vec<u8>, index_data: Vec<u8>) -> Result<Self>
Sourcepub fn list_ids(&self) -> Vec<PackObjectId>
pub fn list_ids(&self) -> Vec<PackObjectId>
List all object ids in this pack.
pub fn list_hashes(&self) -> Vec<ContentHash>
pub fn has_object(&self, id: &PackObjectId) -> bool
Sourcepub fn get_object(
&self,
id: &PackObjectId,
) -> Result<Option<(ObjectType, Vec<u8>)>>
pub fn get_object( &self, id: &PackObjectId, ) -> Result<Option<(ObjectType, Vec<u8>)>>
Get an object from the pack.
pub fn get_hashed_object( &self, hash: &ContentHash, ) -> Result<Option<(ObjectType, Vec<u8>)>>
Sourcepub fn get_hashed_object_size(&self, hash: &ContentHash) -> Result<Option<u64>>
pub fn get_hashed_object_size(&self, hash: &ContentHash) -> Result<Option<u64>>
Read just the type+size header for an object without
decompressing its payload. Returns Ok(None) when the object
isn’t in this pack.
For non-delta entries this is one varint decode at the indexed
offset — much cheaper than get_object. Delta entries fall
back to a full read because their resolved size requires
chasing the base; in practice deltas are rare in the directory
listing hot path so the fallback is acceptable.
Auto Trait Implementations§
impl Freeze for PackReader
impl RefUnwindSafe for PackReader
impl Send for PackReader
impl Sync for PackReader
impl Unpin for PackReader
impl UnsafeUnpin for PackReader
impl UnwindSafe for PackReader
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