Skip to main content

PackWriteOptions

Struct PackWriteOptions 

Source
pub struct PackWriteOptions {
    pub window: usize,
    pub depth: usize,
    pub prefer_ofs_delta: bool,
    pub thin_bases: HashMap<ObjectId, EncodedObject>,
    pub reorder: bool,
    pub compression_level: u32,
}
Expand description

Options controlling sliding-window delta selection during pack generation.

Construct with PackWriteOptions::new (sensible defaults) and adjust with the builder-style setters, or build one directly. Used by PackFile::write_packed_with_options and PackFile::write_thin.

Fields§

§window: usize

Number of previous same-type candidates each object is deltified against. Larger windows find better deltas at higher cost.

§depth: usize

Maximum delta chain depth. A value of 0 disables deltification.

§prefer_ofs_delta: bool

When true, in-pack deltas are encoded as ofs-deltas (the default and git’s preference). When false, in-pack deltas use ref-deltas. Deltas against external thin-pack bases always use ref-deltas regardless.

§thin_bases: HashMap<ObjectId, EncodedObject>

External base objects, keyed by object id, that are not written into the pack but may be used as delta bases. Supplying any entries here produces a thin pack (see PackFile::write_thin). Empty by default, yielding a self-contained pack.

§reorder: bool

When true (the default), objects are reordered by type and size for better delta locality. When false, the input order is preserved (the emitted pack lists objects in the order supplied); deltas then only reference earlier input objects. Reordering is always skipped when deltification is disabled (depth == 0), since it has no effect there.

§compression_level: u32

Zlib compression level for pack entry payloads.

Implementations§

Source§

impl PackWriteOptions

Source

pub fn new() -> Self

Options with git-compatible defaults: window DEFAULT_PACK_WINDOW, depth DEFAULT_PACK_DEPTH, ofs-deltas, and no external thin bases.

Source

pub fn with_window(self, window: usize) -> Self

Set the sliding-window size.

Source

pub fn with_depth(self, depth: usize) -> Self

Set the maximum delta chain depth (0 disables deltas).

Source

pub fn with_prefer_ofs_delta(self, prefer_ofs_delta: bool) -> Self

Choose whether in-pack deltas use ofs-delta (true) or ref-delta (false) base references.

Source

pub fn with_thin_bases( self, thin_bases: HashMap<ObjectId, EncodedObject>, ) -> Self

Provide the set of external base objects permitted for a thin pack.

Source

pub fn with_reorder(self, reorder: bool) -> Self

Choose whether objects may be reordered for delta locality (true) or emitted in input order (false).

Source

pub fn with_compression_level(self, level: u32) -> Self

Set the zlib compression level used for pack entry payloads.

Trait Implementations§

Source§

impl Clone for PackWriteOptions

Source§

fn clone(&self) -> PackWriteOptions

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for PackWriteOptions

Source§

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

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

impl Default for PackWriteOptions

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, 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.