pub struct Tree {
pub id: ObjectHash,
pub tree_items: Vec<TreeItem>,
}Expand description
A tree object is a Git object that represents a directory. It contains a list of entries, one for each file or directory in the tree.
Fields§
§id: ObjectHash§tree_items: Vec<TreeItem>Implementations§
Source§impl Tree
impl Tree
Sourcepub fn from_tree_items_with_kind(
kind: HashKind,
tree_items: Vec<TreeItem>,
) -> Result<Self, GitError>
pub fn from_tree_items_with_kind( kind: HashKind, tree_items: Vec<TreeItem>, ) -> Result<Self, GitError>
Create a new Tree from a list of TreeItems, hashing with an explicit repository kind.
Does not consult the thread-local HashKind. Every entry ID must
belong to kind; a cross-kind reference fails closed with
GitError::InvalidHashValue.
Sourcepub fn from_tree_items(tree_items: Vec<TreeItem>) -> Result<Self, GitError>
pub fn from_tree_items(tree_items: Vec<TreeItem>) -> Result<Self, GitError>
Create a new Tree from a list of TreeItems
Uses the thread-local HashKind; see Tree::from_tree_items_with_kind.
Sourcepub fn rehash_with_kind(&mut self, kind: HashKind) -> Result<(), GitError>
pub fn rehash_with_kind(&mut self, kind: HashKind) -> Result<(), GitError>
Recalculate the tree ID for an explicit repository kind after the entries changed.
Every entry ID must belong to kind; on failure the ID is left unchanged.
Sourcepub fn rehash(&mut self)
pub fn rehash(&mut self)
After the subdirectory is changed, the hash value of the tree is recalculated.
Uses the thread-local HashKind; see Tree::rehash_with_kind.
Trait Implementations§
Source§impl Archive for Tree
impl Archive for Tree
Source§const COPY_OPTIMIZATION: CopyOptimization<Self>
const COPY_OPTIMIZATION: CopyOptimization<Self>
serialize. Read moreSource§type Archived = ArchivedTree
type Archived = ArchivedTree
Source§type Resolver = TreeResolver
type Resolver = TreeResolver
Source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl<__D: Fallible + ?Sized> Deserialize<Tree, __D> for Archived<Tree>where
ObjectHash: Archive,
<ObjectHash as Archive>::Archived: Deserialize<ObjectHash, __D>,
Vec<TreeItem>: Archive,
<Vec<TreeItem> as Archive>::Archived: Deserialize<Vec<TreeItem>, __D>,
impl<__D: Fallible + ?Sized> Deserialize<Tree, __D> for Archived<Tree>where
ObjectHash: Archive,
<ObjectHash as Archive>::Archived: Deserialize<ObjectHash, __D>,
Vec<TreeItem>: Archive,
<Vec<TreeItem> as Archive>::Archived: Deserialize<Vec<TreeItem>, __D>,
impl Eq for Tree
Source§impl ObjectTrait for Tree
impl ObjectTrait for Tree
Source§fn from_bytes(data: &[u8], hash: ObjectHash) -> Result<Self, GitError>where
Self: Sized,
fn from_bytes(data: &[u8], hash: ObjectHash) -> Result<Self, GitError>where
Self: Sized,
Parse a tree body. Entry IDs are sliced with the width of hash.kind() —
the repository kind of the tree being loaded — never the thread-local
kind, so an explicit-kind loader works on any thread.
Source§fn get_type(&self) -> ObjectType
fn get_type(&self) -> ObjectType
fn get_size(&self) -> usize
fn to_data(&self) -> Result<Vec<u8>, GitError>
Source§fn from_buf_read_with_kind<R: BufRead>(
read: &mut ReadBoxed<R>,
size: usize,
kind: HashKind,
) -> Result<Self, GitError>where
Self: Sized,
fn from_buf_read_with_kind<R: BufRead>(
read: &mut ReadBoxed<R>,
size: usize,
kind: HashKind,
) -> Result<Self, GitError>where
Self: Sized,
ReadBoxed<BufRead> whose hasher was created
for kind (see ReadBoxed::new_with_kind). Read moreSource§fn from_buf_read<R: BufRead>(read: &mut ReadBoxed<R>, size: usize) -> Selfwhere
Self: Sized,
fn from_buf_read<R: BufRead>(read: &mut ReadBoxed<R>, size: usize) -> Selfwhere
Self: Sized,
ReadBoxed<BufRead>.
the input size,is only for new a vec with directive space allocation
the input data stream and output object should be plain base object . Read moreSource§fn object_hash_for_kind(&self, kind: HashKind) -> Result<ObjectHash, GitError>
fn object_hash_for_kind(&self, kind: HashKind) -> Result<ObjectHash, GitError>
kind. Read moreSource§fn object_hash(&self) -> Result<ObjectHash, GitError>
fn object_hash(&self) -> Result<ObjectHash, GitError>
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> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<T> ArchiveUnsized for Twhere
T: Archive,
impl<T> ArchiveUnsized for Twhere
T: Archive,
Source§type Archived = <T as Archive>::Archived
type Archived = <T as Archive>::Archived
Archive, it may be
unsized. Read moreSource§fn archived_metadata(
&self,
) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
fn archived_metadata( &self, ) -> <<T as ArchiveUnsized>::Archived as ArchivePointee>::ArchivedMetadata
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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> FileLoadStore for Twhere
T: Archive + for<'a> Serialize<Strategy<Serializer<AlignedVec, ArenaHandle<'a>, Share>, Error>>,
<T as Archive>::Archived: for<'a> CheckBytes<Strategy<Validator<ArchiveValidator<'a>, SharedValidator>, Error>> + Deserialize<T, Strategy<Pool, Error>>,
impl<T> FileLoadStore for Twhere
T: Archive + for<'a> Serialize<Strategy<Serializer<AlignedVec, ArenaHandle<'a>, Share>, Error>>,
<T as Archive>::Archived: for<'a> CheckBytes<Strategy<Validator<ArchiveValidator<'a>, SharedValidator>, Error>> + Deserialize<T, Strategy<Pool, Error>>,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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> ⓘ
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> ⓘ
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.