pub trait Node: Send + Sync {
// Required methods
fn id(&self) -> NodeId;
fn name(&self) -> String;
fn input_channels(&mut self) -> &mut InChannels;
fn output_channels(&mut self) -> &mut OutChannels;
fn run<'life0, 'async_trait>(
&'life0 mut self,
env: Arc<EnvVar>,
) -> Pin<Box<dyn Future<Output = Output> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
// Provided methods
fn is_condition(&self) -> bool { ... }
fn loop_structure(&self) -> Option<Vec<Arc<Mutex<dyn Node>>>> { ... }
}Expand description
§The Node trait
Nodes are the basic scheduling units of Graph. They can be identified by
a globally assigned NodeId and a user-provided name.
Nodes can communicate with others asynchronously through InChannels and OutChannels.
In addition to the above properties, users can also customize some other attributes.
Required Methods§
Sourcefn id(&self) -> NodeId
fn id(&self) -> NodeId
id is the unique identifier of each node, it will be assigned by the NodeTable
when creating a new node, you can find this node through this identifier.
Sourcefn input_channels(&mut self) -> &mut InChannels
fn input_channels(&mut self) -> &mut InChannels
Input Channels of this node.
Sourcefn output_channels(&mut self) -> &mut OutChannels
fn output_channels(&mut self) -> &mut OutChannels
Output Channels of this node.
Provided Methods§
Sourcefn is_condition(&self) -> bool
fn is_condition(&self) -> bool
Return true if this node is conditional node. By default, it returns false.
Sourcefn loop_structure(&self) -> Option<Vec<Arc<Mutex<dyn Node>>>>
fn loop_structure(&self) -> Option<Vec<Arc<Mutex<dyn Node>>>>
Returns the list of nodes that are part of this node’s loop structure, if any.
This method is used to identify nodes that are part of a loop-like structure, such as a loop subgraph. When this method returns Some(nodes), the loop detection check will skip checking these nodes for cycles.
Returns None by default, indicating this is not a loop-containing node.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".