[][src]Struct indextree::NodeId

pub struct NodeId { /* fields omitted */ }

A node identifier within a particular Arena

Methods

impl NodeId[src]

pub fn new(index0: usize) -> Self[src]

Create a NodeId used for attempting to get Nodes references from an Arena.

Note that a zero-based index should be given.

Panics

Panics if the value is usize::max_value().

pub fn from_non_zero_usize(index1: NonZeroUsize) -> Self[src]

Creates a new NodeId from the given one-based index.

Important traits for Ancestors<'a, T>
pub fn ancestors<T>(self, arena: &Arena<T>) -> Ancestors<T>[src]

Return an iterator of references to this node and its ancestors.

Call .next().unwrap() once on the iterator to skip the node itself.

Important traits for PrecedingSiblings<'a, T>
pub fn preceding_siblings<T>(self, arena: &Arena<T>) -> PrecedingSiblings<T>[src]

Return an iterator of references to this node and the siblings before it.

Call .next().unwrap() once on the iterator to skip the node itself.

Important traits for FollowingSiblings<'a, T>
pub fn following_siblings<T>(self, arena: &Arena<T>) -> FollowingSiblings<T>[src]

Return an iterator of references to this node and the siblings after it.

Call .next().unwrap() once on the iterator to skip the node itself.

Important traits for Children<'a, T>
pub fn children<T>(self, arena: &Arena<T>) -> Children<T>[src]

Return an iterator of references to this node’s children.

Important traits for ReverseChildren<'a, T>
pub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<T>[src]

Return an iterator of references to this node’s children, in reverse order.

Important traits for Descendants<'a, T>
pub fn descendants<T>(self, arena: &Arena<T>) -> Descendants<T>[src]

Return an iterator of references to this node and its descendants, in tree order.

Parent nodes appear before the descendants. Call .next().unwrap() once on the iterator to skip the node itself.

Important traits for Traverse<'a, T>
pub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<T>[src]

Return an iterator of references to this node and its descendants, in tree order.

Important traits for ReverseTraverse<'a, T>
pub fn reverse_traverse<T>(self, arena: &Arena<T>) -> ReverseTraverse<T>[src]

Return an iterator of references to this node and its descendants, in tree order.

pub fn detach<T>(self, arena: &mut Arena<T>)[src]

Detach a node from its parent and siblings. Children are not affected.

pub fn append<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>[src]

Append a new child to this node, after existing children.

pub fn prepend<T>(self, new_child: NodeId, arena: &mut Arena<T>) -> Fallible<()>[src]

Prepend a new child to this node, before existing children.

pub fn insert_after<T>(
    self,
    new_sibling: NodeId,
    arena: &mut Arena<T>
) -> Fallible<()>
[src]

Insert a new sibling after this node.

pub fn insert_before<T>(
    self,
    new_sibling: NodeId,
    arena: &mut Arena<T>
) -> Fallible<()>
[src]

Insert a new sibling before this node. success.

pub fn remove<T>(self, arena: &mut Arena<T>) -> Fallible<()>[src]

Remove a node from the arena. Available children of the removed node will be append to the parent after the previous sibling if available.

Please note that the node will not be removed from the internal arena storage, but marked as removed. Traversing the arena returns a plain iterator and contains removed elements too.

Trait Implementations

impl Eq for NodeId[src]

impl Copy for NodeId[src]

impl PartialOrd<NodeId> for NodeId[src]

impl PartialEq<NodeId> for NodeId[src]

impl Clone for NodeId[src]

default fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Ord for NodeId[src]

default fn max(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the maximum of two values. Read more

default fn min(self, other: Self) -> Self
1.21.0
[src]

Compares and returns the minimum of two values. Read more

default fn clamp(self, min: Self, max: Self) -> Self[src]

🔬 This is a nightly-only experimental API. (clamp)

Restrict a value to a certain interval. Read more

impl Debug for NodeId[src]

impl Hash for NodeId[src]

default fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> Index<NodeId> for Arena<T>[src]

type Output = Node<T>

The returned type after indexing.

impl<T> IndexMut<NodeId> for Arena<T>[src]

impl Display for NodeId[src]

Auto Trait Implementations

impl Send for NodeId

impl Sync for NodeId

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

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

impl<T> From for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

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

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

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

The type returned in the event of a conversion error.