pub struct TreeNode<T> {
pub value: T,
/* private fields */
}Expand description
A single tree node
Fields§
§value: TImplementations§
Source§impl<T> TreeNode<T>
impl<T> TreeNode<T>
Sourcepub fn clear_children(&mut self)
pub fn clear_children(&mut self)
Remove all children of this node
Sourcepub fn remove_child(
parent: &NodeRef<T>,
child: &NodeRef<T>,
) -> Option<NodeRef<T>>
pub fn remove_child( parent: &NodeRef<T>, child: &NodeRef<T>, ) -> Option<NodeRef<T>>
Removes child from parent, returning the detached node when found.
Sourcepub fn append_child(parent: &NodeRef<T>, child: NodeRef<T>) -> bool
pub fn append_child(parent: &NodeRef<T>, child: NodeRef<T>) -> bool
Appends child, moving it from its current parent when necessary.
Returns false when the operation would create a tree cycle.
Sourcepub fn insert_before(
parent: &NodeRef<T>,
child: NodeRef<T>,
reference: &NodeRef<T>,
) -> bool
pub fn insert_before( parent: &NodeRef<T>, child: NodeRef<T>, reference: &NodeRef<T>, ) -> bool
Inserts child immediately before reference, moving it from its
current parent when necessary.
pub fn is_inclusive_ancestor(ancestor: &NodeRef<T>, node: &NodeRef<T>) -> bool
Sourcepub fn insert_child_at(parent: &NodeRef<T>, index: usize, child: NodeRef<T>)
pub fn insert_child_at(parent: &NodeRef<T>, index: usize, child: NodeRef<T>)
Insert a child at a given position
Sourcepub fn add_child_value(parent: &NodeRef<T>, value: T) -> NodeRef<T>
pub fn add_child_value(parent: &NodeRef<T>, value: T) -> NodeRef<T>
Create a child with value and add it to parent
Sourcepub fn replace_child(
parent: &NodeRef<T>,
index: usize,
new_child: NodeRef<T>,
) -> Option<NodeRef<T>>
pub fn replace_child( parent: &NodeRef<T>, index: usize, new_child: NodeRef<T>, ) -> Option<NodeRef<T>>
Replace child at given index
Sourcepub fn find_children_by<F>(&self, predicate: F) -> Vec<NodeRef<T>> ⓘ
pub fn find_children_by<F>(&self, predicate: F) -> Vec<NodeRef<T>> ⓘ
Find direct children matching predicate
Sourcepub fn clone_node(&self, deep: bool) -> NodeRef<T>where
T: Clone,
pub fn clone_node(&self, deep: bool) -> NodeRef<T>where
T: Clone,
Clone node (optionally deep)
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for TreeNode<T>
impl<T> !Send for TreeNode<T>
impl<T> !Sync for TreeNode<T>
impl<T> !UnwindSafe for TreeNode<T>
impl<T> Freeze for TreeNode<T>where
T: Freeze,
impl<T> Unpin for TreeNode<T>where
T: Unpin,
impl<T> UnsafeUnpin for TreeNode<T>where
T: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more