[][src]Struct dogear::Tree

pub struct Tree { /* fields omitted */ }

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.

Methods

impl Tree[src]

pub fn with_root(root: Item) -> Builder[src]

Returns a builder for a rooted tree.

pub fn size(&self) -> usize[src]

Returns the number of nodes in the tree.

pub fn root(&self) -> Node[src]

Returns the root node.

pub fn deletions(&self) -> impl Iterator<Item = &Guid>[src]

Returns an iterator for all tombstoned GUIDs.

pub fn is_deleted(&self, guid: &Guid) -> bool[src]

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.

pub fn note_deleted(&mut self, guid: Guid)[src]

Notes a tombstone for a deleted item.

pub fn guids(&self) -> impl Iterator<Item = &Guid>[src]

Returns an iterator for all node and tombstone GUIDs.

pub fn node_for_guid(&self, guid: &Guid) -> Option<Node>[src]

Returns the node for a given guid, or None if a node with the guid doesn't exist in the tree, or was deleted.

pub fn problems(&self) -> &Problems[src]

Returns the structure divergences found when building the tree.

Trait Implementations

impl Debug for Tree[src]

impl Display for Tree[src]

Auto Trait Implementations

impl Send for Tree

impl Sync for Tree

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]