[−][src]Struct read_tree::Vertex
An internal type that stores the payload and relationships of a node in a
Tree
<T>
or PolyTree
<T>
.
Every node on the tree is represented by a Vertex
<T>
. The len
field
stores the number of descendants the node has; this is the number of nodes
in the subtree below the node. A leaf node has length 0
.
Every Tree
<T>
contains a Vec
<
Vertex
<T>>
representing the
trees nodes in a depth first order; meaning every vertex is followed by its
first child. This makes it very easy to take a slice of the vertex buffer
that represents a subtree. We expose such a slice to the user as a
Node
<T>
.
The type implements Clone
and Copy
as long as the payload T
implements the same. Supporting Copy
is important to ensure
Vec::extend_from_slice
executes as fast as possible. This method is used
by Sapling::push_tree
to copy the nodes of a tree into another sapling.
Methods
impl<T> Vertex<T>
[src]
pub fn new(data: T, len: usize) -> Self
[src]
Returns a new vertex with payload data
intending to own len
many
descendants.
Trait Implementations
impl<T: Clone> Clone for Vertex<T>
[src]
impl<T: Copy> Copy for Vertex<T>
[src]
impl<T: Debug> Debug for Vertex<T>
[src]
Auto Trait Implementations
impl<T> Send for Vertex<T> where
T: Send,
T: Send,
impl<T> Sync for Vertex<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Vertex<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Vertex<T> where
T: UnwindSafe,
T: UnwindSafe,
impl<T> RefUnwindSafe for Vertex<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,