pub struct Tree { /* private fields */ }
Expand description
A complete, rooted bookmark tree with tombstones.
The tree stores bookmark items in a vector, and uses indices in the vector to identify parents and children. This makes traversal and lookup very efficient. Retrieving a node’s parent takes one indexing operation, retrieving children takes one indexing operation per child, and retrieving a node by random GUID takes one hash map lookup and one indexing operation.
Implementations
sourceimpl Tree
impl Tree
sourcepub fn is_deleted(&self, guid: &Guid) -> bool
pub fn is_deleted(&self, guid: &Guid) -> bool
Indicates if the GUID is known to be deleted. If Tree::node_for_guid
returns None
and Tree::is_deleted
returns false
, the item doesn’t
exist in the tree at all.
sourcepub fn mentions(&self, guid: &Guid) -> bool
pub fn mentions(&self, guid: &Guid) -> bool
Indicates if the GUID is mentioned in the tree, either as a node or a deletion.
sourcepub fn guids(&self) -> impl Iterator<Item = &Guid>
pub fn guids(&self) -> impl Iterator<Item = &Guid>
Returns an iterator for all node and tombstone GUIDs.
sourcepub fn node_for_guid(&self, guid: &Guid) -> Option<Node<'_>>
pub fn node_for_guid(&self, guid: &Guid) -> Option<Node<'_>>
Returns the node for a given guid
, or None
if a node with the guid
doesn’t exist in the tree, or was deleted.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Tree
impl Send for Tree
impl Sync for Tree
impl Unpin for Tree
impl UnwindSafe for Tree
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more