NodeConfig

Struct NodeConfig 

Source
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: String

TODO: doesn’t show actual path yet

Implementations§

Source§

impl NodeConfig

Source

pub fn new(blackboard: Blackboard) -> NodeConfig

Source

pub fn blackboard(&self) -> &Blackboard

Returns a reference to the blackboard.

Source

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.

Source

pub fn has_port(&self, direction: &PortDirection, name: &String) -> bool

Source

pub fn manifest(&self) -> Result<Arc<TreeNodeManifest>, ParseError>

Returns a pointer to the TreeNodeManifest for this node. Only used during XML parsing.

Source

pub fn set_manifest(&mut self, manifest: Arc<TreeNodeManifest>)

Replace the inner manifest.

Source

pub fn get_input<T>(&mut self, port: &str) -> Result<T, NodeError>
where T: FromString + Clone + Send + 'static,

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
  • T doesn’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 as T
  • If port value is a string, couldn’t convert it to T using parse_str().
Source

pub async fn set_output<T>( &mut self, port: &str, value: T, ) -> Result<(), NodeError>
where T: Clone + Send + 'static,

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
Source

pub async fn set_output_sync<T>( &mut self, port: &str, value: T, ) -> Result<(), NodeError>
where T: Clone + Send + 'static,

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

Source§

fn clone(&self) -> NodeConfig

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodeConfig

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.