pub struct Tree { /* private fields */ }Expand description
A tree object, which represents a directory. It contains the direct entries
of the directory. Subdirectories are represented by the TreeValue::Tree
variant. The Tree object associated with the root directory thus
represents the entire repository at a given point in time.
The entries must be sorted (by RepoPathComponentBuf’s ordering) and must
not contain duplicate names.
Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_sorted_entries(
entries: Vec<(RepoPathComponentBuf, TreeValue)>,
) -> Self
pub fn from_sorted_entries( entries: Vec<(RepoPathComponentBuf, TreeValue)>, ) -> Self
Creates a new Tree from the given entries. The entries must be sorted
by name and must not contain duplicate names.
Sourcepub fn names(&self) -> impl Iterator<Item = &RepoPathComponent>
pub fn names(&self) -> impl Iterator<Item = &RepoPathComponent>
Returns an iterator over the names of the entries in this tree.
Sourcepub fn entries(&self) -> TreeEntriesNonRecursiveIterator<'_> ⓘ
pub fn entries(&self) -> TreeEntriesNonRecursiveIterator<'_> ⓘ
Returns an iterator over the entries in this tree.
Sourcepub fn entry(&self, name: &RepoPathComponent) -> Option<TreeEntry<'_>>
pub fn entry(&self, name: &RepoPathComponent) -> Option<TreeEntry<'_>>
Returns the entry at the given basename, if it exists.
Sourcepub fn value(&self, name: &RepoPathComponent) -> Option<&TreeValue>
pub fn value(&self, name: &RepoPathComponent) -> Option<&TreeValue>
Returns the value at the given basename, if it exists.
Trait Implementations§
Source§impl ContentHash for Tree
impl ContentHash for Tree
Source§fn hash(&self, state: &mut impl DigestUpdate)
fn hash(&self, state: &mut impl DigestUpdate)
Update the hasher state with this object’s content
impl Eq for Tree
impl StructuralPartialEq for Tree
Auto Trait Implementations§
impl Freeze for Tree
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnsafeUnpin for Tree
impl UnwindSafe for Tree
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more