pub struct UnifiedNodeDeque<Data: Debug> { /* private fields */ }
Available on crate features unified and deque only.
Expand description

A node that is not split into separate branch and leaf nodes.

This is the deque version, where children are represented as a VecDeque. In this version, a node’s previous sibling(s) and next sibling(s) are not available, but the node can be directly indexed, and children can be detached, removed, or inserted by index.

[Data] represents the custom data associated with the node.

See also

For the non-deque version, see [UnifiedNode].

For a node that is split into separate branch and leaf nodes, see [SplitNode] and [SplitNodeDeque].

Trait Implementations§

source§

impl<Data: Debug> BaseNode for UnifiedNodeDeque<Data>

§

type Representation = UnifiedNodeRepresentation<Data>

The representation of the node after it is removed from the arena. Read more
§

type Branch = UnifiedNodeDeque<Data>

The type used for branch nodes. Read more
§

type Leaf = UnifiedNodeDeque<Data>

The type used for leaf nodes. Read more
source§

fn into_representation(self, arena: &mut Arena<Self>) -> Self::Representation

Converts this node into its representation. Read more
source§

impl<Data: Debug> BranchNode for UnifiedNodeDeque<Data>

§

type ChildrenIter<'branch> = Copied<Iter<'branch, Token<UnifiedNodeDeque<Data>>>> where Self: 'branch

The iterator returned by children.
source§

fn first(&self) -> Option<Token<Self>>

Returns the token of this branch node’s first child. Read more
source§

fn last(&self) -> Option<Token<Self>>

Returns the token of this branch node’s last child. Read more
source§

fn children<'branch>( &'branch self, _arena: &'branch Arena<Self::Base> ) -> Self::ChildrenIter<'branch>

Returns an iterator over the tokens of this branch node’s children.
source§

fn is_empty(&self) -> bool

Returns whether this branch node has no children.
source§

fn detach_front( token: Self::Token, arena: &mut Arena<Self::Base> ) -> Option<Token<Self>>

Detaches this branch node’s first child, returning its token. Read more
source§

fn detach_back( token: Self::Token, arena: &mut Arena<Self::Base> ) -> Option<Token<Self>>

Detaches this branch node’s last child, returning its token. Read more
source§

fn pop_front( token: Self::Token, arena: &mut Arena<Self::Base> ) -> Option<UnifiedNodeRepresentation<Data>>

Removes this branch node’s first child. Read more
source§

fn pop_back( token: Self::Token, arena: &mut Arena<Self::Base> ) -> Option<UnifiedNodeRepresentation<Data>>

Removes this branch node’s last child. Read more
source§

fn push_front( token: Self::Token, arena: &mut Arena<Self::Base>, new: Token<Self> )

Pushes the given new token’s node to the beginning of this branch node’s children. Read more
source§

fn push_back( token: Self::Token, arena: &mut Arena<Self::Base>, new: Token<Self> )

Pushes the given new token’s node to the end of this branch node’s children. Read more
source§

fn descendants<'branch>( &'branch self, arena: &'branch Arena<Self::Base> ) -> Descendants<'branch, Self>
where Self: Sized, for<'base> &'base Self: TryFrom<&'base Self::Base>,

Returns an iterator over the tokens of this branch node’s descendants. Read more
source§

impl<Data: Debug> BranchNodeDeque for UnifiedNodeDeque<Data>

source§

fn len(&self) -> usize

Available on crate feature deque only.
Returns the number of children this branch node has.
source§

fn detach( token: Self::Token, arena: &mut Arena<Self>, index: usize ) -> Token<Self>

Available on crate feature deque only.
Detaches the child at the given index, returning its token. Read more
source§

fn remove( token: Self::Token, arena: &mut Arena<Self>, index: usize ) -> UnifiedNodeRepresentation<Data>

Available on crate feature deque only.
Removes the child at the given index. Read more
source§

fn insert( token: Self::Token, arena: &mut Arena<Self::Base>, index: usize, new: Token<Self> )

Available on crate feature deque only.
Inserts the given new token’s node at the given index. Read more
source§

fn get(&self, index: usize) -> Option<<Self::Base as Node>::Token>

Available on crate feature deque only.
Returns the token of the child at the given index. Read more
source§

impl<Data: Debug + Debug> Debug for UnifiedNodeDeque<Data>

source§

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

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

impl<Data: Debug> Hash for UnifiedNodeDeque<Data>

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<Data: Debug> Index<usize> for UnifiedNodeDeque<Data>

§

type Output = Token<UnifiedNodeDeque<Data>>

The returned type after indexing.
source§

fn index(&self, index: usize) -> &Self::Output

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

impl<Data: Debug> Node for UnifiedNodeDeque<Data>

§

type Base = UnifiedNodeDeque<Data>

The ‘base node’ used in the arena. Read more
§

type Token = Token<UnifiedNodeDeque<Data>>

The token associated with this type of node.
§

type Data = Data

The custom data associated with this node.
§

type DataRef<'data> = &'data Data where Self: 'data

A type acting as a reference to the node’s data. Read more
§

type DataRefMut<'data> = &'data mut Data where Self: 'data

A type acting as a mutable reference to the node’s data. Read more
source§

fn new(arena: &mut Arena<Self::Base>, data: Self::Data) -> Self::Token
where Self: Sized,

Creates a new node allocated in the given arena using the given data. Read more
source§

fn token(&self) -> Self::Token

Returns this node’s token.
source§

fn parent(&self) -> Option<Token<Self>>

Returns the token of this node’s parent. Read more
source§

fn data(&self) -> &Self::Data

Returns a reference to the data associated with this node.
source§

fn data_mut(&mut self) -> &mut Self::Data

Returns a mutable reference to the data associated with this node.
source§

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

Returns an iterator over the tokens of this node’s ancestors. Read more
source§

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

Returns this node’s root node. Read more
source§

impl<Data: Debug> PartialEq for UnifiedNodeDeque<Data>

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<Data: Debug> Eq for UnifiedNodeDeque<Data>

Auto Trait Implementations§

§

impl<Data> RefUnwindSafe for UnifiedNodeDeque<Data>
where Data: RefUnwindSafe,

§

impl<Data> Send for UnifiedNodeDeque<Data>
where Data: Send,

§

impl<Data> Sync for UnifiedNodeDeque<Data>
where Data: Sync,

§

impl<Data> Unpin for UnifiedNodeDeque<Data>
where Data: Unpin,

§

impl<Data> UnwindSafe for UnifiedNodeDeque<Data>
where Data: UnwindSafe,

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> 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, U> TryFrom<U> for T
where U: Into<T>,

§

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>,

§

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.