Struct git2::Tree [−][src]
pub struct Tree<'repo> { /* fields omitted */ }Expand description
A structure to represent a git tree
Implementations
impl<'repo> Tree<'repo>[src]
impl<'repo> Tree<'repo>[src]pub fn walk<C, T>(&self, mode: TreeWalkMode, callback: C) -> Result<(), Error> where
C: FnMut(&str, &TreeEntry<'_>) -> T,
T: Into<i32>, [src]
pub fn walk<C, T>(&self, mode: TreeWalkMode, callback: C) -> Result<(), Error> where
C: FnMut(&str, &TreeEntry<'_>) -> T,
T: Into<i32>, [src]Traverse the entries in a tree and its subtrees in post or pre order. The callback function will be run on each node of the tree that’s walked. The return code of this function will determine how the walk continues.
libgit requires that the callback be an integer, where 0 indicates a
successful visit, 1 skips the node, and -1 aborts the traversal completely.
You may opt to use the enum TreeWalkResult instead.
let mut ct = 0; tree.walk(TreeWalkMode::PreOrder, |_, entry| { assert_eq!(entry.name(), Some("foo")); ct += 1; TreeWalkResult::Ok }).unwrap(); assert_eq!(ct, 1);
See libgit documentation for more information.
pub fn get(&self, n: usize) -> Option<TreeEntry<'_>>[src]
pub fn get(&self, n: usize) -> Option<TreeEntry<'_>>[src]Lookup a tree entry by its position in the tree
pub fn get_name(&self, filename: &str) -> Option<TreeEntry<'_>>[src]
pub fn get_name(&self, filename: &str) -> Option<TreeEntry<'_>>[src]Lookup a tree entry by its filename
pub fn get_path(&self, path: &Path) -> Result<TreeEntry<'static>, Error>[src]
pub fn get_path(&self, path: &Path) -> Result<TreeEntry<'static>, Error>[src]Retrieve a tree entry contained in a tree or in any of its subtrees, given its relative path.
pub fn into_object(self) -> Object<'repo>[src]
pub fn into_object(self) -> Object<'repo>[src]Consumes Commit to be returned as an Object
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
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more
impl<T> ToOwned for T where
T: Clone, [src]
impl<T> ToOwned for T where
T: Clone, [src]type Owned = T
type Owned = TThe resulting type after obtaining ownership.
pub fn to_owned(&self) -> T[src]
pub fn to_owned(&self) -> T[src]Creates owned data from borrowed data, usually by cloning. Read more
pub fn clone_into(&self, target: &mut T)[src]
pub fn clone_into(&self, target: &mut T)[src]🔬 This is a nightly-only experimental API. (toowned_clone_into)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more