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>::Tokenwhere
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 detach(
token: Self::Token,
arena: &mut Arena<Self::Base>,
index: usize
) -> <Self::Base as Node>::Tokenwhere
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,
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>::Representationwhere
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>::Representationwhere
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,
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
)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,
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§
Object Safety§
Implementors§
impl<Data: Debug> BranchNodeDeque for UnifiedNodeDeque<Data>
unified
only.