[][src]Struct git_odb::pack::tree::Tree

pub struct Tree<T> { /* fields omitted */ }

A tree that allows one-time iteration over all nodes and their children, consuming it in the process, while being shareable among threads without a lock. It does this by making the run-time guarantee that iteration only happens once.

Implementations

impl<T> Tree<T>[src][]

Iteration

pub fn iter_root_chunks(&mut self, size: usize) -> Chunks<T>

Important traits for Chunks<'a, T>

impl<'a, T> Iterator for Chunks<'a, T> where
    T: Default
type Item = Vec<Node<'a, T>>;
[src][]

Return an iterator over chunks of roots. Roots are not children themselves, they have no parents.

impl<T> Tree<T> where
    T: Default + Send
[src][]

pub fn traverse<F, P, MBFN, S, E>(
    self,
    should_run_in_parallel: impl FnOnce() -> bool,
    resolve: F,
    object_progress: P,
    size_progress: P,
    thread_limit: Option<usize>,
    pack_entries_end: u64,
    new_thread_state: impl Fn() -> S + Send + Sync,
    inspect_object: MBFN
) -> Result<Vec<Item<T>>, Error> where
    F: for<'r> Fn(EntrySlice, &'r mut Vec<u8>) -> Option<()> + Send + Sync,
    P: Progress + Send,
    MBFN: Fn(&mut T, &mut <P as Progress>::SubProgress, Context<S>) -> Result<(), E> + Send + Sync,
    E: Error + Send + Sync + 'static, 
[src]

impl<T> Tree<T>[src][]

Generate tree from certain input

pub fn from_offsets_in_pack(
    data_sorted_by_offsets: impl Iterator<Item = T>,
    get_pack_offset: impl Fn(&T) -> u64,
    pack_path: impl AsRef<Path>,
    progress: impl Progress,
    resolve_in_pack_id: impl Fn(Id) -> Option<u64>
) -> Result<Self, Error>
[src][]

The sort order is ascending. The given packfile path must match the provided offsets.

impl<T> Tree<T>[src][]

pub fn with_capacity(num_objects: usize) -> Result<Self, Error>[src]

pub fn add_root(&mut self, offset: u64, data: T) -> Result<(), Error>[src]

pub fn add_child(
    &mut self,
    base_offset: u64,
    offset: u64,
    data: T
) -> Result<(), Error>
[src]

pub fn into_items(self) -> Vec<Item<T>>[src]

Trait Implementations

impl<T> Sync for Tree<T>[src]

SAFETY: We solemnly swear…that this is sync because without the unsafe cell, it is also sync. But that's really the only reason why I would dare to know.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Tree<T>

impl<T> Send for Tree<T> where
    T: Send

impl<T> Unpin for Tree<T> where
    T: Unpin

impl<T> UnwindSafe for Tree<T> where
    T: UnwindSafe

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>, 
[+]