pub struct Tree { /* private fields */ }Implementations§
Source§impl Tree
impl Tree
pub fn new() -> Tree
pub fn from_entries(entries: Vec<TreeEntry>) -> Tree
Sourcepub fn try_from_decoded_entries(
entries: Vec<TreeEntry>,
) -> Result<Tree, TreeError>
pub fn try_from_decoded_entries( entries: Vec<TreeEntry>, ) -> Result<Tree, TreeError>
Build a tree from entries that are already in canonical name order.
Unlike Self::from_entries, this does not sort. Decoders use it so
eager and streaming paths reject the same out-of-order or duplicate
encodings instead of silently canonicalizing them.
pub fn validate(&self) -> Result<(), TreeError>
pub fn entries(&self) -> &[TreeEntry]
pub fn get(&self, name: &str) -> Option<&TreeEntry>
pub fn insert(&mut self, entry: TreeEntry)
pub fn remove(&mut self, name: &str) -> Option<TreeEntry>
pub fn is_empty(&self) -> bool
pub fn len(&self) -> usize
pub fn hash(&self) -> ContentHash
pub fn iter(&self) -> impl Iterator<Item = &TreeEntry>
pub fn get_path(&self, path: &Path) -> Option<&TreeEntry>
Source§impl Tree
impl Tree
pub fn decode_current_msgpack(data: &[u8]) -> Result<Tree, TreeDecodeError>
Source§impl Tree
impl Tree
Sourcepub fn encode_canonical(&self) -> Result<Vec<u8>, TreeStreamError>
pub fn encode_canonical(&self) -> Result<Vec<u8>, TreeStreamError>
Encode this tree as uncompressed HTR4.
Sourcepub fn decode_canonical(data: &[u8]) -> Result<Tree, TreeStreamError>
pub fn decode_canonical(data: &[u8]) -> Result<Tree, TreeStreamError>
Decode a complete HTR4 body, validating order incrementally.
Sourcepub fn encode_canonical_blocked(
&self,
level: i32,
min_size: usize,
) -> Result<Vec<u8>, TreeStreamError>
pub fn encode_canonical_blocked( &self, level: i32, min_size: usize, ) -> Result<Vec<u8>, TreeStreamError>
Encode block-compressed HTR4, falling back to raw v4 when the complete object would not be smaller. Callers apply the small-tree policy.
Source§impl Tree
impl Tree
Sourcepub fn encode_lean(&self) -> Result<Vec<u8>, TreeStreamError>
pub fn encode_lean(&self) -> Result<Vec<u8>, TreeStreamError>
Encode a cheap HLR1 materialized anchor. The content hash deliberately stays outside the body and must be supplied by the object store while decoding.
Sourcepub fn decode_lean(
data: &[u8],
expected: ContentHash,
) -> Result<Tree, TreeStreamError>
pub fn decode_lean( data: &[u8], expected: ContentHash, ) -> Result<Tree, TreeStreamError>
Decode a complete HLR1 anchor and validate it against its object key.
Source§impl Tree
impl Tree
Sourcepub fn decode_canonical_streamed(data: &[u8]) -> Result<Tree, TreeStreamError>
pub fn decode_canonical_streamed(data: &[u8]) -> Result<Tree, TreeStreamError>
Decode HTR4 through the streaming reader and collect the eager Tree.