Trait LinkedNode

Source
pub trait LinkedNode: Node
where Self::Base: LinkedNode,
{ // Required methods fn prev(&self) -> Option<<Self::Base as Node>::Token>; fn next(&self) -> Option<<Self::Base as Node>::Token>; // Provided methods fn preceding_siblings<'node>( &'node self, arena: &'node Arena<Self::Base>, ) -> PrecedingSiblings<'node, Self> where Self: Sized { ... } fn following_siblings<'node>( &'node self, arena: &'node Arena<Self::Base>, ) -> FollowingSiblings<'node, Self> where Self: Sized { ... } }
Expand description

A node that is linked to its previous and next siblings.

Required Methods§

Source

fn prev(&self) -> Option<<Self::Base as Node>::Token>

Returns the token of this node’s previous sibling.

If this node is the first child of its parent, that means there is no previous sibling and thus None is returned.

Source

fn next(&self) -> Option<<Self::Base as Node>::Token>

Returns the token of this node’s next sibling.

If this node is the last child of its parent, that means there is no next sibling and thus None is returned.

Provided Methods§

Source

fn preceding_siblings<'node>( &'node self, arena: &'node Arena<Self::Base>, ) -> PrecedingSiblings<'node, Self>
where Self: Sized,

Returns an iterator over the tokens of this node’s preceding siblings.

This iterator begins with the previous node and ends with the first child of the parent node.

If this is the first child, the iterator will be empty.

Source

fn following_siblings<'node>( &'node self, arena: &'node Arena<Self::Base>, ) -> FollowingSiblings<'node, Self>
where Self: Sized,

Returns an iterator over the tokens of this node’s following siblings.

This iterator begins with the next node and ends with the last child of the parent node.

If this is the last child, the iterator will be empty.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<BranchData, LeafData> LinkedNode for SplitNode<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Available on crate feature split only.
Source§

impl<BranchData, LeafData> LinkedNode for Branch<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Available on crate feature split only.
Source§

impl<BranchData, LeafData> LinkedNode for Leaf<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Available on crate feature split only.
Source§

impl<Data: Debug> LinkedNode for UnifiedNode<Data>

Available on crate feature unified only.