Struct git2::TreeBuilder [−][src]
Constructor for in-memory trees
Implementations
impl<'repo> TreeBuilder<'repo>
[src][−]
pub fn clear(&mut self)
[src][−]
Clear all the entries in the builder
pub fn len(&self) -> usize
[src][−]
Get the number of entries
pub fn is_empty(&self) -> bool
[src][−]
Return true
if there is no entry
pub fn get<P>(&self, filename: P) -> Result<Option<TreeEntry<'_>>, Error> where
P: IntoCString,
[src][−]
P: IntoCString,
Get en entry from the builder from its filename
pub fn insert<P: IntoCString>(
&mut self,
filename: P,
oid: Oid,
filemode: i32
) -> Result<TreeEntry<'_>, Error>
[src][−]
&mut self,
filename: P,
oid: Oid,
filemode: i32
) -> Result<TreeEntry<'_>, Error>
Add or update an entry in the builder
No attempt is made to ensure that the provided Oid points to an object of a reasonable type (or any object at all).
The mode given must be one of 0o040000, 0o100644, 0o100755, 0o120000 or 0o160000 currently.
pub fn remove<P: IntoCString>(&mut self, filename: P) -> Result<(), Error>
[src][−]
Remove an entry from the builder by its filename
pub fn filter<F>(&mut self, filter: F) where
F: FnMut(&TreeEntry<'_>) -> bool,
[src][−]
F: FnMut(&TreeEntry<'_>) -> bool,
Selectively remove entries from the tree
Values for which the filter returns true
will be kept. Note
that this behavior is different from the libgit2 C interface.
pub fn write(&self) -> Result<Oid, Error>
[src][−]
Write the contents of the TreeBuilder as a Tree object and return its Oid
Trait Implementations
impl<'repo> Drop for TreeBuilder<'repo>
[src][+]
Auto Trait Implementations
impl<'repo> RefUnwindSafe for TreeBuilder<'repo>
impl<'repo> !Send for TreeBuilder<'repo>
impl<'repo> !Sync for TreeBuilder<'repo>
impl<'repo> Unpin for TreeBuilder<'repo>
impl<'repo> UnwindSafe for TreeBuilder<'repo>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,