pub struct RuntimeTree {
pub root: RNodeId,
pub nodes: HashMap<RNodeId, RNode>,
}Expand description
The runtime tree is a representation of the compilation tree supplemented with some runtime information.
Fields§
§root: RNodeId§nodes: HashMap<RNodeId, RNode>Implementations§
Source§impl RuntimeTree
impl RuntimeTree
Sourcepub fn iter(&self) -> RtTreeBfsIter<'_> ⓘ
pub fn iter(&self) -> RtTreeBfsIter<'_> ⓘ
Returns bfs iterator over the runtime tree
Sourcepub fn analyze(&self) -> RtTreeAnalyzer<'_>
pub fn analyze(&self) -> RtTreeAnalyzer<'_>
Returns the analyzer for the runtime tree which provides methods to analyze the tree and find nodes by some criteria
§Example
use forester_rs::runtime::args::RtArgs;
use forester_rs::runtime::rtree::builder::RtNodeBuilder;
use forester_rs::runtime::rtree::builder::RtTreeBuilder;
use forester_rs::runtime::rtree::rnode::FlowType;
use forester_rs::runtime::rtree::rnode::RNodeName;
use forester_rs::*;
#[test]
fn analyzer() {
let mut rtb = RtTreeBuilder::new();
let flow = flow!(fallback node_name!("root"), args!();
flow!(sequence node_name!("seq"), args!();
action!(node_name!("action1"))
),
action!(node_name!("action2"))
);
rtb.add_as_root(flow);
let tree = rtb.build().unwrap().0;
let analyzer = tree.analyze();
let a1 = analyzer.find_id_by(|n| n.is_name("action1")).unwrap();
let a2 = analyzer.find_id_by(|n| n.is_name("action2")).unwrap();
let root = analyzer.find_id_by(|n| n.is_name("root")).unwrap();
let seq = analyzer.find_id_by(|n| n.is_name("seq")).unwrap();
assert_eq!(analyzer.parent(&a1), Some(&seq));
assert_eq!(analyzer.parent(&a2), Some(&root));
assert_eq!(analyzer.parent(&root), None);
}Sourcepub fn build(project: Project) -> Result<RuntimeTreeStarter, TreeError>
pub fn build(project: Project) -> Result<RuntimeTreeStarter, TreeError>
Builds the runtime tree from the project
Converts the runtime tree into the ROS navigation xml file
Trait Implementations§
Source§impl Debug for RuntimeTree
impl Debug for RuntimeTree
Source§impl Default for RuntimeTree
impl Default for RuntimeTree
Source§fn default() -> RuntimeTree
fn default() -> RuntimeTree
Returns the “default value” for a type. Read more
Source§impl PartialEq for RuntimeTree
impl PartialEq for RuntimeTree
impl StructuralPartialEq for RuntimeTree
Auto Trait Implementations§
impl Freeze for RuntimeTree
impl RefUnwindSafe for RuntimeTree
impl Send for RuntimeTree
impl Sync for RuntimeTree
impl Unpin for RuntimeTree
impl UnwindSafe for RuntimeTree
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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