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.
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.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tree
impl<'de> Deserialize<'de> for Tree
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Tree, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Tree, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Tree
Source§impl IntoIterator for Tree
impl IntoIterator for Tree
Source§impl<'a> IntoIterator for &'a Tree
impl<'a> IntoIterator for &'a Tree
Source§impl Serialize for Tree
impl Serialize for Tree
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
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