[][src]Struct git2::PackBuilder

pub struct PackBuilder<'repo> { /* fields omitted */ }

A builder for creating a packfile

Methods

impl<'repo> PackBuilder<'repo>
[src]

pub fn insert_object(
    &mut self,
    id: Oid,
    name: Option<&str>
) -> Result<(), Error>
[src]

Insert a single object. For an optimal pack it's mandatory to insert objects in recency order, commits followed by trees and blobs.

pub fn insert_tree(&mut self, id: Oid) -> Result<(), Error>
[src]

Insert a root tree object. This will add the tree as well as all referenced trees and blobs.

pub fn insert_commit(&mut self, id: Oid) -> Result<(), Error>
[src]

Insert a commit object. This will add a commit as well as the completed referenced tree.

pub fn insert_walk(&mut self, walk: &mut Revwalk) -> Result<(), Error>
[src]

Insert objects as given by the walk. Those commits and all objects they reference will be inserted into the packbuilder.

pub fn insert_recursive(
    &mut self,
    id: Oid,
    name: Option<&str>
) -> Result<(), Error>
[src]

Recursively insert an object and its referenced objects. Insert the object as well as any object it references.

pub fn write_buf(&mut self, buf: &mut Buf) -> Result<(), Error>
[src]

Write the contents of the packfile to an in-memory buffer. The contents of the buffer will become a valid packfile, even though there will be no attached index.

pub fn foreach<F>(&mut self, cb: F) -> Result<(), Error> where
    F: FnMut(&[u8]) -> bool
[src]

Create the new pack and pass each object to the callback.

pub fn set_progress_callback<F>(&mut self, progress: F) -> Result<(), Error> where
    F: FnMut(PackBuilderStage, u32, u32) -> bool + 'repo, 
[src]

progress will be called with progress information during pack building. Be aware that this is called inline with pack building operations, so performance may be affected.

There can only be one progress callback attached, this will replace any existing one. See unset_progress_callback to remove the current progress callback without attaching a new one.

pub fn unset_progress_callback(&mut self) -> Result<(), Error>
[src]

Remove the current progress callback. See set_progress_callback to set the progress callback.

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

Get the total number of objects the packbuilder will write out.

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

Get the number of objects the packbuilder has already written out.

pub fn hash(&self) -> Option<Oid>
[src]

Get the packfile's hash. A packfile's name is derived from the sorted hashing of all object names. This is only correct after the packfile has been written.

Trait Implementations

impl<'repo> Drop for PackBuilder<'repo>
[src]

Auto Trait Implementations

impl<'repo> !Send for PackBuilder<'repo>

impl<'repo> !Sync for PackBuilder<'repo>

Blanket Implementations

impl<T> From for T
[src]

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

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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