Struct git_repository::Tree
source · [−]Expand description
A decoded tree object with access to its owning repository.
Fields
id: ObjectId
The id of the tree
data: Vec<u8>
The fully decoded tree data
Implementations
sourceimpl<'repo> Tree<'repo>
impl<'repo> Tree<'repo>
Access
sourcepub fn lookup_path<I, P>(self, path: I) -> Result<Option<Entry>, Error<Error>> where
I: IntoIterator<Item = P>,
P: PartialEq<BStr>,
pub fn lookup_path<I, P>(self, path: I) -> Result<Option<Entry>, Error<Error>> where
I: IntoIterator<Item = P>,
P: PartialEq<BStr>,
Follow a sequence of path
components starting from this instance, and look them up one by one until the last component
is looked up and its tree entry is returned.
Performance Notes
Searching tree entries is currently done in sequence, which allows to the search to be allocation free. It would be possible to re-use a vector and use a binary search instead, which might be able to improve performance over all. However, a benchmark should be created first to have some data and see which trade-off to choose here.
Trait Implementations
Auto Trait Implementations
impl<'repo> !RefUnwindSafe for Tree<'repo>
impl<'repo> !Send for Tree<'repo>
impl<'repo> !Sync for Tree<'repo>
impl<'repo> Unpin for Tree<'repo>
impl<'repo> !UnwindSafe for Tree<'repo>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more