Struct Branch

Source
pub struct Branch<BranchData: Debug, LeafData: Debug> { /* private fields */ }
Available on crate feature split only.
Expand description

The node representing branches in a split node tree.

Branches are nodes which may have children, as opposed to leaves, which may not have children.

BranchData represents the custom data associated with branch nodes.

Trait Implementations§

Source§

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

Source§

type ChildrenIter<'branch> = ChildrenLinked<'branch, Branch<BranchData, LeafData>> where Self: 'branch

The iterator returned by children.
Source§

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

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

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

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<<Self::Base as Node>::Token>

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<<Self::Base as Node>::Token>

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<<Self::Base as BaseNode>::Representation>

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

fn pop_back( token: Self::Token, arena: &mut Arena<Self::Base>, ) -> Option<<Self::Base as BaseNode>::Representation>

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

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

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: <Self::Base as Node>::Token, )

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<BranchData: Debug + Debug, LeafData: Debug + Debug> Debug for Branch<BranchData, LeafData>

Source§

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

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

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

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<BranchData, LeafData> LinkedNode for Branch<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Source§

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

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

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

Returns the token of this node’s next sibling. Read more
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. Read more
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. Read more
Source§

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

Source§

type Base = SplitNode<BranchData, LeafData>

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

type Token = Token<Branch<BranchData, LeafData>>

The token associated with this type of node.
Source§

type Data = BranchData

The custom data associated with this node.
Source§

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

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

type DataRefMut<'data> = &'data mut BranchData 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) -> Token<Self>

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) -> &BranchData

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

fn data_mut(&mut self) -> &mut BranchData

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<BranchData, LeafData, Other: Node> PartialEq<Other> for Branch<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug, <Self as Node>::Token: PartialEq<Other::Token>,

Source§

fn eq(&self, other: &Other) -> 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<'node, BranchData, LeafData> TryFrom<&'node SplitNode<BranchData, LeafData>> for &'node Branch<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Source§

type Error = &'node SplitNode<BranchData, LeafData>

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

fn try_from( node: &'node SplitNode<BranchData, LeafData>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'node, BranchData, LeafData> TryFrom<&'node mut SplitNode<BranchData, LeafData>> for &'node mut Branch<BranchData, LeafData>
where BranchData: Debug, LeafData: Debug,

Source§

type Error = &'node mut SplitNode<BranchData, LeafData>

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

fn try_from( node: &'node mut SplitNode<BranchData, LeafData>, ) -> Result<Self, Self::Error>

Performs the conversion.
Source§

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

Auto Trait Implementations§

§

impl<BranchData, LeafData> Freeze for Branch<BranchData, LeafData>
where BranchData: Freeze,

§

impl<BranchData, LeafData> RefUnwindSafe for Branch<BranchData, LeafData>
where BranchData: RefUnwindSafe, LeafData: RefUnwindSafe,

§

impl<BranchData, LeafData> Send for Branch<BranchData, LeafData>
where BranchData: Send, LeafData: Send,

§

impl<BranchData, LeafData> Sync for Branch<BranchData, LeafData>
where BranchData: Sync, LeafData: Sync,

§

impl<BranchData, LeafData> Unpin for Branch<BranchData, LeafData>
where BranchData: Unpin, LeafData: Unpin,

§

impl<BranchData, LeafData> UnwindSafe for Branch<BranchData, LeafData>
where BranchData: UnwindSafe, LeafData: 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>,

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.