Struct synctree::Node [−][src]
pub struct Node<T> { /* fields omitted */ }
A reference to the tree node.
It has an Id, and the reference-counted data.
Most of the functions will block until there are no
more writers, holding the RwLock
.
There may be more than one reader to the data, though.
Methods
impl<T> Node<T>
[src]
impl<T> Node<T>
pub fn new(data: T, arena: &NodeArena<T>) -> Node<T>
[src]
pub fn new(data: T, arena: &NodeArena<T>) -> Node<T>
Creates a new node in the provided arena.
pub fn read<'a>(
&'a self
) -> impl Deref<Target = T> + 'a
[src]
pub fn read<'a>(
&'a self
) -> impl Deref<Target = T> + 'a
Returns a handle, dereferencing to the node data.
This function will block until there are no more writers.
pub fn write<'a>(
&'a self
) -> impl DerefMut<Target = T> + 'a
[src]
pub fn write<'a>(
&'a self
) -> impl DerefMut<Target = T> + 'a
Returns a mutable handle, dereferencing to the node data.
This function will block until there are no more writers and readers.
pub fn parent(&self, arena: &NodeArena<T>) -> Option<Node<T>>
[src]
pub fn parent(&self, arena: &NodeArena<T>) -> Option<Node<T>>
Returns node's parent, if any.
pub fn first_child(&self, arena: &NodeArena<T>) -> Option<Node<T>>
[src]
pub fn first_child(&self, arena: &NodeArena<T>) -> Option<Node<T>>
Returns node's first child, if any.
pub fn last_child(&self, arena: &NodeArena<T>) -> Option<Node<T>>
[src]
pub fn last_child(&self, arena: &NodeArena<T>) -> Option<Node<T>>
Returns node's last child, if any.
pub fn next_sibling(&self, arena: &NodeArena<T>) -> Option<Node<T>>
[src]
pub fn next_sibling(&self, arena: &NodeArena<T>) -> Option<Node<T>>
Returns node's next sibling, if any.
pub fn prev_sibling(&self, arena: &NodeArena<T>) -> Option<Node<T>>
[src]
pub fn prev_sibling(&self, arena: &NodeArena<T>) -> Option<Node<T>>
Returns node's previous sibling, if any.
ⓘImportant traits for Children<'a, T>pub fn children<'a>(&self, arena: &'a NodeArena<T>) -> Children<'a, T>
[src]
pub fn children<'a>(&self, arena: &'a NodeArena<T>) -> Children<'a, T>
Returns an iterator over node's children.
ⓘImportant traits for Ancestors<'a, T>pub fn ancestors<'a>(&self, arena: &'a NodeArena<T>) -> Ancestors<'a, T>
[src]
pub fn ancestors<'a>(&self, arena: &'a NodeArena<T>) -> Ancestors<'a, T>
Returns an iterator over node's ancestors.
ⓘImportant traits for Siblings<'a, T>pub fn siblings<'a>(&self, arena: &'a NodeArena<T>) -> Siblings<'a, T>
[src]
pub fn siblings<'a>(&self, arena: &'a NodeArena<T>) -> Siblings<'a, T>
Returns an iterator over node's ancestors, including itself.
ⓘImportant traits for DFTraverse<'a, T>pub fn depth_first_traverse<'a>(
&'a self,
arena: &'a NodeArena<T>
) -> DFTraverse<'a, T>
[src]
pub fn depth_first_traverse<'a>(
&'a self,
arena: &'a NodeArena<T>
) -> DFTraverse<'a, T>
Returns an iterator over node's descendants, including itself, in NLR depth-first order.
pub fn detach(&self, arena: &NodeArena<T>)
[src]
pub fn detach(&self, arena: &NodeArena<T>)
Detachs a node from it's parent.
If node does not have a parent, does nothing.
pub fn append(&self, node: &Node<T>, arena: &NodeArena<T>)
[src]
pub fn append(&self, node: &Node<T>, arena: &NodeArena<T>)
Appends a new child to node, e.g. after the existing children.
If the parent node did not have any children before, this operation is the same as prepend.
pub fn prepend(&self, node: &Node<T>, arena: &NodeArena<T>)
[src]
pub fn prepend(&self, node: &Node<T>, arena: &NodeArena<T>)
Prepends a new child to node, e.g. before the existing children.
If the parent node did not have any children before, this operation is the same as append.
pub fn ptr_eq(&self, other: &Node<T>) -> bool
[src]
pub fn ptr_eq(&self, other: &Node<T>) -> bool
Returns true, if a node points to the same data as the other one.
Trait Implementations
impl<T: Debug> Debug for Node<T>
[src]
impl<T: Debug> Debug for Node<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T> Clone for Node<T>
[src]
impl<T> Clone for Node<T>