pub struct TreeNode {
pub data: TreeNodeData,
pub context: Box<dyn Any + Send + Sync>,
pub tick_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, Result<NodeStatus, NodeError>>,
pub start_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, Result<NodeStatus, NodeError>>,
pub halt_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, ()>,
}Fields§
§data: TreeNodeData§context: Box<dyn Any + Send + Sync>§tick_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, Result<NodeStatus, NodeError>>Function pointer to tick
start_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, Result<NodeStatus, NodeError>>Function pointer to on_start function (if StatefulActionNode) Otherwise points to tick_fn
halt_fn: for<'a> fn(&'a mut TreeNodeData, &'a mut Box<dyn Any + Send + Sync>) -> BoxFuture<'a, ()>Function pointer to halt
Implementations§
Source§impl TreeNode
impl TreeNode
Sourcepub fn status(&self) -> NodeStatus
pub fn status(&self) -> NodeStatus
Returns the current node’s status
Sourcepub fn reset_status(&mut self)
pub fn reset_status(&mut self)
Resets the status back to NodeStatus::Idle
Sourcepub fn set_status(&mut self, status: NodeStatus)
pub fn set_status(&mut self, status: NodeStatus)
Update the node’s status
Sourcepub async fn execute_tick(&mut self) -> NodeResult
pub async fn execute_tick(&mut self) -> NodeResult
Tick the node
Sourcepub fn config_mut(&mut self) -> &mut NodeConfig
pub fn config_mut(&mut self) -> &mut NodeConfig
Get a mutable reference to the NodeConfig
Sourcepub fn config(&self) -> &NodeConfig
pub fn config(&self) -> &NodeConfig
Get a reference to the NodeConfig
Sourcepub fn node_type(&self) -> NodeType
pub fn node_type(&self) -> NodeType
Get the node’s NodeType, which is only:
NodeType::ControlNodeType::DecoratorNodeType::SyncActionNodeType::StatefulAction
Sourcepub fn node_category(&self) -> NodeCategory
pub fn node_category(&self) -> NodeCategory
Get the node’s NodeCategory, which is more general than NodeType
Sourcepub fn provided_ports(&self) -> PortsList
pub fn provided_ports(&self) -> PortsList
Call the node’s ports() function if it has one, returning the
PortsList object
Sourcepub fn children(&self) -> Option<impl Iterator<Item = &TreeNode>>
pub fn children(&self) -> Option<impl Iterator<Item = &TreeNode>>
Return an iterator over the children. Returns None if this node
has no children (i.e. an Action node)
Sourcepub fn children_mut(&mut self) -> Option<impl Iterator<Item = &mut TreeNode>>
pub fn children_mut(&mut self) -> Option<impl Iterator<Item = &mut TreeNode>>
Return a mutable iterator over the children. Returns None if this node
has no children (i.e. an Action node)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TreeNode
impl !RefUnwindSafe for TreeNode
impl Send for TreeNode
impl Sync for TreeNode
impl Unpin for TreeNode
impl !UnwindSafe for TreeNode
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