TreeNode

Struct TreeNode 

Source
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

Source

pub fn status(&self) -> NodeStatus

Returns the current node’s status

Source

pub fn reset_status(&mut self)

Resets the status back to NodeStatus::Idle

Source

pub fn set_status(&mut self, status: NodeStatus)

Update the node’s status

Source

pub async fn execute_tick(&mut self) -> NodeResult

Tick the node

Source

pub async fn halt(&mut self)

Halt the node

Source

pub fn name(&self) -> &str

Get the name of the node

Source

pub fn config_mut(&mut self) -> &mut NodeConfig

Get a mutable reference to the NodeConfig

Source

pub fn config(&self) -> &NodeConfig

Get a reference to the NodeConfig

Source

pub fn node_type(&self) -> NodeType

Get the node’s NodeType, which is only:

  • NodeType::Control
  • NodeType::Decorator
  • NodeType::SyncAction
  • NodeType::StatefulAction
Source

pub fn node_category(&self) -> NodeCategory

Get the node’s NodeCategory, which is more general than NodeType

Source

pub fn provided_ports(&self) -> PortsList

Call the node’s ports() function if it has one, returning the PortsList object

Source

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)

Source

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§

Source§

impl Debug for TreeNode

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.