pub struct NodeConfig {
pub blackboard: Blackboard,
pub input_ports: PortsRemapping,
pub output_ports: PortsRemapping,
pub manifest: Option<Arc<TreeNodeManifest>>,
pub uid: u16,
pub path: String,
/* private fields */
}Expand description
Contains all common configuration that all types of nodes use.
Fields§
§blackboard: Blackboard§input_ports: PortsRemapping§output_ports: PortsRemapping§manifest: Option<Arc<TreeNodeManifest>>§uid: u16§path: StringTODO: doesn’t show actual path yet
Implementations§
Source§impl NodeConfig
impl NodeConfig
pub fn new(blackboard: Blackboard) -> NodeConfig
Sourcepub fn blackboard(&self) -> &Blackboard
pub fn blackboard(&self) -> &Blackboard
Returns a reference to the blackboard.
Sourcepub fn add_port(
&mut self,
direction: PortDirection,
name: String,
value: String,
)
pub fn add_port( &mut self, direction: PortDirection, name: String, value: String, )
Adds a port to the config based on the direction. Used during XML parsing.
pub fn has_port(&self, direction: &PortDirection, name: &String) -> bool
Sourcepub fn manifest(&self) -> Result<Arc<TreeNodeManifest>, ParseError>
pub fn manifest(&self) -> Result<Arc<TreeNodeManifest>, ParseError>
Returns a pointer to the TreeNodeManifest for this node.
Only used during XML parsing.
Sourcepub fn set_manifest(&mut self, manifest: Arc<TreeNodeManifest>)
pub fn set_manifest(&mut self, manifest: Arc<TreeNodeManifest>)
Replace the inner manifest.
Sourcepub fn get_input<T>(&mut self, port: &str) -> Result<T, NodeError>
pub fn get_input<T>(&mut self, port: &str) -> Result<T, NodeError>
Returns the value of the input port at the port key as a Result<T, NodeError>.
The value is Err in the following situations:
- The port wasn’t found at that key
Tdoesn’t match the type of the stored value- If a default value is needed (value is empty), couldn’t parse default value
- If a remapped key (e.g. a port value of
"{foo}"references the blackboard key"foo"), blackboard entry wasn’t found or couldn’t be read asT - If port value is a string, couldn’t convert it to
Tusingparse_str().
Sourcepub async fn set_output<T>(
&mut self,
port: &str,
value: T,
) -> Result<(), NodeError>
pub async fn set_output<T>( &mut self, port: &str, value: T, ) -> Result<(), NodeError>
Sets value into the blackboard. The key is based on the value provided
to the port at port.
§Examples
- Port value:
"=": uses the port name as the blackboard key "foo"uses"foo"as the blackboard key"{foo}"uses"foo"as the blackboard key
Sourcepub async fn set_output_sync<T>(
&mut self,
port: &str,
value: T,
) -> Result<(), NodeError>
pub async fn set_output_sync<T>( &mut self, port: &str, value: T, ) -> Result<(), NodeError>
Sync version of set_output<T>
Sets value into the blackboard. The key is based on the value provided
to the port at port.
§Examples
- Port value:
"=": uses the port name as the blackboard key "foo"uses"foo"as the blackboard key"{foo}"uses"foo"as the blackboard key
Trait Implementations§
Source§impl Clone for NodeConfig
impl Clone for NodeConfig
Source§fn clone(&self) -> NodeConfig
fn clone(&self) -> NodeConfig
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for NodeConfig
impl RefUnwindSafe for NodeConfig
impl Send for NodeConfig
impl Sync for NodeConfig
impl Unpin for NodeConfig
impl UnwindSafe for NodeConfig
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