[−][src]Struct git2::Tree
A structure to represent a git tree
Methods
impl<'repo> Tree<'repo>
[src]
pub fn id(&self) -> Oid
[src]
Get the id (SHA1) of a repository object
pub fn len(&self) -> usize
[src]
Get the number of entries listed in this tree.
pub fn is_empty(&self) -> bool
[src]
Return true
if there is not entry
ⓘImportant traits for TreeIter<'tree>pub fn iter(&self) -> TreeIter
[src]
Returns an iterator over the entries in this tree.
pub fn walk<C, T>(&self, mode: TreeWalkMode, callback: C) -> Result<(), Error> where
C: FnMut(&str, &TreeEntry) -> T,
T: Into<i32>,
[src]
C: FnMut(&str, &TreeEntry) -> T,
T: Into<i32>,
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_id(&self, id: Oid) -> Option<TreeEntry>
[src]
Lookup a tree entry by SHA value.
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]
Lookup a tree entry by its filename
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 as_object(&self) -> &Object<'repo>
[src]
Casts this Tree to be usable as an Object
pub fn into_object(self) -> Object<'repo>
[src]
Consumes Commit to be returned as an Object
Trait Implementations
impl<'repo> Drop for Tree<'repo>
[src]
impl<'repo> Clone for Tree<'repo>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'repo, 'iter> IntoIterator for &'iter Tree<'repo>
[src]
type Item = TreeEntry<'iter>
The type of the elements being iterated over.
type IntoIter = TreeIter<'iter>
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter
[src]
impl<'repo> Debug for Tree<'repo>
[src]
Auto Trait Implementations
impl<'repo> Unpin for Tree<'repo>
impl<'repo> !Sync for Tree<'repo>
impl<'repo> !Send for Tree<'repo>
impl<'repo> UnwindSafe for Tree<'repo>
impl<'repo> RefUnwindSafe for Tree<'repo>
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,