[−][src]Struct indextree::NodeId
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 Node
s 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]
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
Insert a new sibling after this node.
pub fn insert_before<T>(
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
[src]
self,
new_sibling: NodeId,
arena: &mut Arena<T>
) -> Fallible<()>
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 PartialOrd<NodeId> for NodeId
[src]
fn partial_cmp(&self, other: &NodeId) -> Option<Ordering>
[src]
fn lt(&self, other: &NodeId) -> bool
[src]
fn le(&self, other: &NodeId) -> bool
[src]
fn gt(&self, other: &NodeId) -> bool
[src]
fn ge(&self, other: &NodeId) -> bool
[src]
impl Copy for NodeId
[src]
impl PartialEq<NodeId> for NodeId
[src]
impl Clone for NodeId
[src]
fn clone(&self) -> NodeId
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for NodeId
[src]
fn cmp(&self, other: &NodeId) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
fn clamp(self, min: Self, max: Self) -> Self
[src]
clamp
)Returns max if self is greater than max, and min if self is less than min. Otherwise this will return self. Panics if min > max. Read more
impl Eq for NodeId
[src]
impl Display for NodeId
[src]
impl Debug for NodeId
[src]
impl<T> Index<NodeId> for Arena<T>
[src]
type Output = Node<T>
The returned type after indexing.
fn index(&self, node: NodeId) -> &Node<T>
[src]
impl<T> IndexMut<NodeId> for Arena<T>
[src]
impl Hash for NodeId
[src]
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,