[][src]Struct git_odb::pack::data::File

pub struct File { /* fields omitted */ }

Implementations

impl File[src][]

Reading of objects

pub fn decompress_entry(
    &self,
    entry: &Entry,
    out: &mut [u8]
) -> Result<usize, Error>
[src]

pub fn entry(&self, offset: u64) -> Entry[src]

pub fn decode_entry(
    &self,
    entry: Entry,
    out: &mut Vec<u8>,
    resolve: impl Fn(Id, &mut Vec<u8>) -> Option<ResolvedBase>,
    delta_cache: &mut impl DecodeEntry
) -> Result<Outcome, Error>
[src][]

Decode an entry, resolving delta's as needed, while growing the output vector if there is not enough space to hold the result object. Returns (object_kind, compressed_size), referring to the entry in-pack size for use with CRC32 checks such as in crc32(pack_data[entry.data_offset..entry.data_offset + compressed_size])

impl File[src][]

Instantiation

pub fn at(path: impl AsRef<Path>) -> Result<File, Error>[src]

impl File[src][]

Checksums and verify checksums

pub fn checksum(&self) -> Id[src]

pub fn verify_checksum(&self, progress: impl Progress) -> Result<Id, Error>[src]

impl File[src][]

pub fn streaming_iter(&self) -> Result<Iter<impl BufRead>, Error>[src][]

Returns an iterator over the pack file itself, without making use of the memory mapping.

Note that this iterator is costly as no pack index is used, forcing each entry to be decompressed. If an index is available, use the traverse(…) method instead for maximum performance.

impl File[src][]

pub const HEADER_LEN: usize[src]

pub fn kind(&self) -> Kind[src]

pub fn num_objects(&self) -> u32[src]

pub fn data_len(&self) -> usize[src][]

The length of all mapped data, including the pack header and the pack trailer

pub fn pack_end(&self) -> usize[src][]

The position of the byte one past the last entry, or in other terms, the first byte of the trailing hash.

pub fn path(&self) -> &Path[src]

pub fn entry_slice(&self, slice: EntrySlice) -> Option<&[u8]>[src]

pub fn entry_crc32(&self, pack_offset: u64, size: usize) -> u32[src][]

Currently only done during pack verification - finding the right size is only possible by decompressing the pack entry beforehand, or by using the (to be sorted) offsets stored in an index file.

Trait Implementations

impl<'_> TryFrom<&'_ Path> for File[src][+]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl RefUnwindSafe for File

impl Send for File

impl Sync for File

impl Unpin for File

impl UnwindSafe for File

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src][+]

impl<T> Borrow<T> for T where
    T: ?Sized
[src][+]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src][+]

impl<T> From<T> for T[src][+]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src][+]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src][+]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src][+]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[+]