pub trait BranchNodeDeque: BranchNode{
// Required methods
fn len(&self) -> usize;
fn detach(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
) -> <Self::Base as Node>::Token
where Self: Sized,
for<'base> &'base mut Self: TryFrom<&'base mut Self::Base>,
for<'base> <&'base mut Self as TryFrom<&'base mut Self::Base>>::Error: Debug;
fn remove(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
) -> <Self::Base as BaseNode>::Representation
where Self: Sized,
for<'base> &'base mut Self: TryFrom<&'base mut Self::Base>,
for<'base> <&'base mut Self as TryFrom<&'base mut Self::Base>>::Error: Debug;
fn insert(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
new: <Self::Base as Node>::Token,
)
where Self: Sized,
for<'base> &'base mut Self: TryFrom<&'base mut Self::Base>,
for<'base> <&'base mut Self as TryFrom<&'base mut Self::Base>>::Error: Debug;
// Provided method
fn get(&self, index: usize) -> Option<<Self::Base as Node>::Token> { ... }
}
deque
only.Required Methods§
Sourcefn detach(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
) -> <Self::Base as Node>::Token
fn detach( token: Self::Token, arena: &mut Arena<Self::Base>, index: usize, ) -> <Self::Base as Node>::Token
Detaches the child at the given index
, returning its token.
This function is useful if you want to move a node from one parent to another.
This function takes its token as a parameter instead of &mut self
as a receiver to avoid
having multiple mutable references into the arena at a time.
§Panics
This method will panic if the given index
is out of bounds.
§See also
The first child or last child may be detached with detach_front
and detach_back
respectively.
If you want to remove a child and its descendents from the arena altogether, see
remove
, pop_front
, or pop_back
.
Sourcefn remove(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
) -> <Self::Base as BaseNode>::Representation
fn remove( token: Self::Token, arena: &mut Arena<Self::Base>, index: usize, ) -> <Self::Base as BaseNode>::Representation
Removes the child at the given index
.
This function takes its token as a parameter instead of &mut self
as a receiver to avoid
having multiple mutable references into the arena at a time.
§Panics
This method will panic if the given index
is out of bounds.
§See also
The first child or last child may be removed with pop_front
and pop_back
respectively.
If you don’t want to remove a child from the arena, but merely make it a root node or
move it to another parent, see detach
, detach_front
, or detach_back
.
Sourcefn insert(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize,
new: <Self::Base as Node>::Token,
)
fn insert( token: Self::Token, arena: &mut Arena<Self::Base>, index: usize, new: <Self::Base as Node>::Token, )
Inserts the given new
token’s node at the given index
.
This function takes its token as a parameter instead of &mut self
as a receiver to avoid
having multiple mutable references into the arena at a time.
§Panics
This method will panic if:
§See also
A child can also be pushed to the beginning or end of this branch node’s children with
push_front
and push_back
respectively.
Provided Methods§
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§
impl<BranchData, LeafData> BranchNodeDeque for BranchDeque<BranchData, LeafData>
split
only.impl<Data: Debug> BranchNodeDeque for UnifiedNodeDeque<Data>
unified
only.