pub struct ControlTree<D: Decorator> { /* private fields */ }Implementations§
Source§impl<D: Decorator> ControlTree<D>
impl<D: Decorator> ControlTree<D>
pub fn into_builder(self) -> CTreeBuilder<D>
pub fn builder() -> CTreeBuilder<D>
Source§impl<D: Decorator + From<StandardDecorator>> ControlTree<D>
impl<D: Decorator + From<StandardDecorator>> ControlTree<D>
pub fn add_subtree_as_last_child( &mut self, from: CTreeNodeID, subtree: impl Into<Self>, )
pub fn add_subtree_as_first_child( &mut self, from: CTreeNodeID, subtree: impl Into<Self>, )
Sourcepub fn add_subtree_with_priority(
&mut self,
from: CTreeNodeID,
priority: usize,
subtree: impl Into<Self>,
)
pub fn add_subtree_with_priority( &mut self, from: CTreeNodeID, priority: usize, subtree: impl Into<Self>, )
Add a subtree below the node at from, with a priority value (the position in the
left->right order of the tree). The priority is simply the index in the children vector in
Self::tree, and the bt runs from 0..tree.len().
Source§impl<D: Decorator> ControlTree<D>
impl<D: Decorator> ControlTree<D>
Sourcepub fn add_child(
&mut self,
parent_id: CTreeNodeID,
child: impl Into<CTreeNode<D>>,
) -> ShrubberyResult<CTreeNodeID>
pub fn add_child( &mut self, parent_id: CTreeNodeID, child: impl Into<CTreeNode<D>>, ) -> ShrubberyResult<CTreeNodeID>
Add a new node as a child with a priority (0 runs first).
Sourcepub fn add_child_with_priority(
&mut self,
parent_id: CTreeNodeID,
child: impl Into<CTreeNode<D>>,
priority: usize,
) -> ShrubberyResult<CTreeNodeID>
pub fn add_child_with_priority( &mut self, parent_id: CTreeNodeID, child: impl Into<CTreeNode<D>>, priority: usize, ) -> ShrubberyResult<CTreeNodeID>
Add a new node as a child with a priority (0 runs first).
Sourcepub fn remove(&mut self, id: CTreeNodeID)
pub fn remove(&mut self, id: CTreeNodeID)
Remove a node and all references to it from the tree (does not remove the actual node from
Self::nodes, so you can put it back by ID without re-inserting the node).
Source§impl<D: Decorator> ControlTree<D>
impl<D: Decorator> ControlTree<D>
pub fn iter_control_nodes(&self) -> impl Iterator<Item = &ControlNode<D>> + '_
pub fn iter_decorators(&self) -> impl Iterator<Item = &ControlNode<D>> + '_
pub fn iter_tree( &self, ) -> impl Iterator<Item = (&CTreeNodeID, &Vec<CTreeNodeID>)> + '_
Sourcepub fn status(&self) -> Status
pub fn status(&self) -> Status
The status of the whole control tree (reflected by the status of the root node).
pub fn run<Hook: ExecutorHook>(&mut self, hook: &mut Hook) -> Status
pub fn run_with_update_callback<Hook: ExecutorHook, Callback: UpdateCallback<D>>( &mut self, hook: &mut Hook, cb: &mut Callback, ) -> Status
pub fn run_from<Hook: ExecutorHook>( &mut self, node_id: CTreeNodeID, hook: &mut Hook, ) -> Status
pub fn run_from_with_update_callback<Hook: ExecutorHook, Callback: UpdateCallback<D>>( &mut self, node_id: CTreeNodeID, hook: &mut Hook, cb: &mut Callback, ) -> Status
pub fn reset_branch(&mut self, from: CTreeNodeID)
pub fn new() -> Self
Sourcepub fn as_subtree(&self, start_at: CTreeNodeID) -> Self
pub fn as_subtree(&self, start_at: CTreeNodeID) -> Self
Extract a section of the ControlTree into a new one.
Sourcepub fn insert_between(
&mut self,
parent_id: CTreeNodeID,
move_down: &[CTreeNodeID],
node: impl Into<CTreeNode<D>>,
) -> CTreeNodeID
pub fn insert_between( &mut self, parent_id: CTreeNodeID, move_down: &[CTreeNodeID], node: impl Into<CTreeNode<D>>, ) -> CTreeNodeID
Insert node between parent and move_down.
The inserted node with be the n’th child, where n is the index of the first child
node in move_down. i.e. left->right order is maintained if move_down is contiguous with
the original children.
§Examples
insert_between(0, &[2], X) 0 0
/ | \ ------> / | \
1 2 3 1 X 3
|
2insert_between(0, &[1, 3], X) 0 0
/ | \ ------> / \
1 2 3 X 2
/ \
1 3pub fn iter_children_mut<'a, O>( &'a mut self, node_id: &CTreeNodeID, f: impl FnMut(&mut CTreeNode<D>) -> O + 'a, ) -> impl Iterator<Item = O> + '_
pub fn node_mut(&mut self, id: CTreeNodeID) -> &mut CTreeNode<D>
pub fn children(&self, node_id: &CTreeNodeID) -> Vec<CTreeNodeID>
pub fn iter_children( &self, node_id: &CTreeNodeID, ) -> impl Iterator<Item = &CTreeNode<D>> + '_
pub fn iter_child_ids( &self, node_id: &CTreeNodeID, ) -> impl Iterator<Item = &CTreeNodeID> + '_
Source§impl<D: Decorator + GraphvizAttrs> ControlTree<D>
impl<D: Decorator + GraphvizAttrs> ControlTree<D>
Sourcepub fn run_save_animation(
&mut self,
hook: &mut impl ExecutorHook,
name: &str,
frame_time: f32,
) -> Status
pub fn run_save_animation( &mut self, hook: &mut impl ExecutorHook, name: &str, frame_time: f32, ) -> Status
Runs the control tree and saves the animation to `out/[name].html
XXX: This writes a new svg for every frame, kinda scuffed & not good for performance so only use for debugging
pub fn run_with_animatior<Hook: ExecutorHook>( &mut self, hook: &mut Hook, ) -> GraphvizAnimator
Sourcepub fn graphviz_graph(&self) -> Graph
pub fn graphviz_graph(&self) -> Graph
Get the [graphviz_rust::Graph] representation of the control tree in its current state.
Trait Implementations§
Source§impl<D: Clone + Decorator> Clone for ControlTree<D>
impl<D: Clone + Decorator> Clone for ControlTree<D>
Source§fn clone(&self) -> ControlTree<D>
fn clone(&self) -> ControlTree<D>
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<D: Decorator> Default for ControlTree<D>
impl<D: Decorator> Default for ControlTree<D>
Source§impl<D: Decorator> From<ControlTree<D>> for CTreeBuilder<D>
impl<D: Decorator> From<ControlTree<D>> for CTreeBuilder<D>
Source§fn from(value: ControlTree<D>) -> Self
fn from(value: ControlTree<D>) -> Self
Source§impl<D: Decorator> Index<CTreeNodeID> for ControlTree<D>
impl<D: Decorator> Index<CTreeNodeID> for ControlTree<D>
Source§impl<D: Decorator> IndexMut<CTreeNodeID> for ControlTree<D>
impl<D: Decorator> IndexMut<CTreeNodeID> for ControlTree<D>
Auto Trait Implementations§
impl<D> Freeze for ControlTree<D>
impl<D> RefUnwindSafe for ControlTree<D>where
D: RefUnwindSafe,
impl<D> Send for ControlTree<D>where
D: Send,
impl<D> Sync for ControlTree<D>where
D: Sync,
impl<D> Unpin for ControlTree<D>where
D: Unpin,
impl<D> UnwindSafe for ControlTree<D>where
D: UnwindSafe,
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)