Struct Token

Source
pub struct Token<N: Node> { /* private fields */ }

Trait Implementations§

Source§

impl<N: Node> Clone for Token<N>

Source§

fn clone(&self) -> Self

Returns a copy 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<N: Node> Debug for Token<N>

Source§

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

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

impl<N: Node> Hash for Token<N>

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<N: Node<Token = Self>> NodeToken<N> for Token<N>

Source§

fn parent( &self, arena: &Arena<N::Base>, ) -> Option<<<N::Base as BaseNode>::Branch as Node>::Token>

Returns this node’s parent’s token. Read more
Source§

fn ancestors<'arena>( &self, arena: &'arena Arena<N::Base>, ) -> Ancestors<'arena, N::Base>

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

fn root<'arena>(&self, arena: &'arena Arena<N::Base>) -> RootToken<N>
where for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn data<'arena>(&self, arena: &'arena Arena<N::Base>) -> N::DataRef<'arena>
where for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn data_mut<'arena>( &self, arena: &'arena mut Arena<N::Base>, ) -> N::DataRefMut<'arena>
where for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn prev(&self, arena: &Arena<N::Base>) -> Option<<N::Base as Node>::Token>
where N::Base: LinkedNode,

Returns the token of this node’s previous sibling. Read more
Source§

fn next(&self, arena: &Arena<N::Base>) -> Option<<N::Base as Node>::Token>
where N::Base: LinkedNode,

Returns the token of this node’s next sibling. Read more
Source§

fn preceding_siblings<'arena>( &self, arena: &'arena Arena<N::Base>, ) -> PrecedingSiblings<'arena, N>
where N::Base: LinkedNode,

Returns an iterator over the tokens of this node’s preceding siblings. Read more
Source§

fn following_siblings<'arena>( &self, arena: &'arena Arena<N::Base>, ) -> FollowingSiblings<'arena, N>
where N::Base: LinkedNode,

Returns an iterator over the tokens of this node’s following siblings. Read more
Source§

fn first(&self, arena: &Arena<N::Base>) -> Option<<N::Base as Node>::Token>
where N: BranchNode, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn last(&self, arena: &Arena<N::Base>) -> Option<<N::Base as Node>::Token>
where N: BranchNode, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn children<'arena>( &self, arena: &'arena Arena<N::Base>, ) -> N::ChildrenIter<'arena>
where N: BranchNode, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn descendants<'arena>( &self, arena: &'arena Arena<N::Base>, ) -> Descendants<'arena, N>
where N: BranchNode, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn len(&self, arena: &Arena<N::Base>) -> usize
where N: BranchNodeDeque, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn is_empty(&self, arena: &Arena<N::Base>) -> bool
where N: BranchNode, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

Returns whether this branch node has no children.
Source§

fn get_unchecked( &self, arena: &Arena<N::Base>, index: usize, ) -> <N::Base as Node>::Token
where N: BranchNodeDeque, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn get( &self, arena: &Arena<N::Base>, index: usize, ) -> Option<<N::Base as Node>::Token>
where N: BranchNodeDeque, for<'base> &'base N: TryFrom<&'base N::Base>, for<'base> <&'base N as TryFrom<&'base N::Base>>::Error: Debug,

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

fn detach_front( &self, arena: &mut Arena<N::Base>, ) -> Option<<N::Base as Node>::Token>
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn detach_back( &self, arena: &mut Arena<N::Base>, ) -> Option<<N::Base as Node>::Token>
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn pop_front( &self, arena: &mut Arena<N::Base>, ) -> Option<<N::Base as BaseNode>::Representation>
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn pop_back( &self, arena: &mut Arena<N::Base>, ) -> Option<<N::Base as BaseNode>::Representation>
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn push_front(&self, arena: &mut Arena<N::Base>, new: <N::Base as Node>::Token)
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn push_back(&self, arena: &mut Arena<N::Base>, new: <N::Base as Node>::Token)
where N: BranchNode<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn detach( &self, arena: &mut Arena<N::Base>, index: usize, ) -> <N::Base as Node>::Token
where N: BranchNodeDeque<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn remove( &self, arena: &mut Arena<N::Base>, index: usize, ) -> <N::Base as BaseNode>::Representation
where N: BranchNodeDeque<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

fn insert( &self, arena: &mut Arena<N::Base>, index: usize, new: <N::Base as Node>::Token, )
where N: BranchNodeDeque<Token = Self>, for<'base> &'base mut N: TryFrom<&'base mut N::Base>, for<'base> <&'base mut N as TryFrom<&'base mut N::Base>>::Error: Debug,

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

impl<N: Node, I: Idx> PartialEq<I> for Token<N>

Source§

fn eq(&self, other: &I) -> 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<N: Node> Copy for Token<N>

Source§

impl<N: Node> Eq for Token<N>

Auto Trait Implementations§

§

impl<N> Freeze for Token<N>

§

impl<N> RefUnwindSafe for Token<N>
where N: RefUnwindSafe,

§

impl<N> Send for Token<N>
where N: Send,

§

impl<N> Sync for Token<N>
where N: Sync,

§

impl<N> Unpin for Token<N>
where N: Unpin,

§

impl<N> UnwindSafe for Token<N>
where N: 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> 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.