Struct NodeId

Source
pub struct NodeId { /* private fields */ }
Expand description

A node identifier within a particular Arena

Implementations§

Source§

impl NodeId

Source

pub fn ancestors<T>(self, arena: &Arena<T>) -> Ancestors<'_, T>

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

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

Source

pub fn preceding_siblings<T>(self, arena: &Arena<T>) -> PrecedingSiblings<'_, T>

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.

Source

pub fn following_siblings<T>(self, arena: &Arena<T>) -> FollowingSiblings<'_, T>

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.

Source

pub fn children<T>(self, arena: &Arena<T>) -> Children<'_, T>

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

Source

pub fn reverse_children<T>(self, arena: &Arena<T>) -> ReverseChildren<'_, T>

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

Source

pub fn descendants<T>(self, arena: &Arena<T>) -> Descendants<'_, T>

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.

Source

pub fn traverse<T>(self, arena: &Arena<T>) -> Traverse<'_, T>

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

Source

pub fn reverse_traverse<T>(self, arena: &Arena<T>) -> ReverseTraverse<'_, T>

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

Source

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

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

Source

pub fn append<T>( self, new_child: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>

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

Source

pub fn prepend<T>( self, new_child: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>

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

Source

pub fn insert_after<T>( self, new_sibling: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>

Insert a new sibling after this node.

Source

pub fn insert_before<T>( self, new_sibling: NodeId, arena: &mut Arena<T>, ) -> Result<(), IndexTreeError>

Insert a new sibling before this node.

Trait Implementations§

Source§

impl Clone for NodeId

Source§

fn clone(&self) -> NodeId

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeId

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for NodeId

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

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

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Index<NodeId> for Arena<T>

Source§

type Output = Node<T>

The returned type after indexing.
Source§

fn index(&self, node: NodeId) -> &Node<T>

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<NodeId> for Arena<T>

Source§

fn index_mut(&mut self, node: NodeId) -> &mut Node<T>

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl PartialEq for NodeId

Source§

fn eq(&self, other: &NodeId) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for NodeId

Source§

impl Eq for NodeId

Source§

impl StructuralPartialEq for NodeId

Auto Trait Implementations§

§

impl Freeze for NodeId

§

impl RefUnwindSafe for NodeId

§

impl Send for NodeId

§

impl Sync for NodeId

§

impl Unpin for NodeId

§

impl UnwindSafe for NodeId

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.