pub struct TreeEntry { /* private fields */ }Expand description
A single entry inside a Tree.
An entry is the basic building block of a directory listing. It pairs a name with a kind (blob or subtree) and a hash that points to the actual content.
§Validation
The name must be non‑empty and ≤ MAX_NAME_LENGTH.
§Example
use libvctrl_handler::{Hash, TreeEntry, EntryKind};
let hash = Hash::from_bytes(&[0x11; 64]).unwrap();
// A file entry.
let file = TreeEntry::new("src/main.rs".into(), EntryKind::Blob, hash)
.expect("valid entry");
assert_eq!(file.name(), "src/main.rs");
assert_eq!(file.kind(), EntryKind::Blob);
assert_eq!(file.hash().as_bytes().len(), 64);
// An empty name is rejected.
assert!(TreeEntry::new("".into(), EntryKind::Blob, hash).is_err());Implementations§
Trait Implementations§
impl Eq for TreeEntry
impl StructuralPartialEq for TreeEntry
Auto Trait Implementations§
impl Freeze for TreeEntry
impl RefUnwindSafe for TreeEntry
impl Send for TreeEntry
impl Sync for TreeEntry
impl Unpin for TreeEntry
impl UnsafeUnpin for TreeEntry
impl UnwindSafe for TreeEntry
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