pub struct DefaultNode { /* private fields */ }Expand description
§Default node type
DefaultNode is a default implementation of the Node trait. Users can use this node
type to build tasks to meet most needs.
§Create a DefaultNode:
- use the method
new. Required attributes: node’s name;NodeTable(for id allocation).
use dagrs::{NodeName, NodeTable, DefaultNode};
let node_name = "Node X";
let mut node_table = NodeTable::new();
let mut node = DefaultNode::new(
NodeName::from(node_name),
&mut node_table,
);- use the method
with_action. Required attributes: node’s name;NodeTable(for id allocation); execution logicAction.
use dagrs::{NodeName, NodeTable, DefaultNode, EmptyAction};
let node_name = "Node X";
let mut node_table = NodeTable::new();
let mut node = DefaultNode::with_action(
NodeName::from(node_name),
EmptyAction,
&mut node_table,
);Implementations§
Source§impl DefaultNode
impl DefaultNode
pub fn new(name: String, node_table: &mut NodeTable) -> DefaultNode
pub fn with_action( name: String, action: impl Action + 'static, node_table: &mut NodeTable, ) -> DefaultNode
pub fn set_action(&mut self, action: impl Action + 'static)
Trait Implementations§
Source§impl Node for DefaultNode
impl Node for DefaultNode
Source§fn 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.Source§fn input_channels(&mut self) -> &mut InChannels
fn input_channels(&mut self) -> &mut InChannels
Input Channels of this node.
Source§fn output_channels(&mut self) -> &mut OutChannels
fn output_channels(&mut self) -> &mut OutChannels
Output Channels of this node.
Source§fn run<'life0, 'async_trait>(
&'life0 mut self,
env: Arc<EnvVar>,
) -> Pin<Box<dyn Future<Output = Output> + Send + 'async_trait>>where
'life0: 'async_trait,
DefaultNode: 'async_trait,
fn run<'life0, 'async_trait>(
&'life0 mut self,
env: Arc<EnvVar>,
) -> Pin<Box<dyn Future<Output = Output> + Send + 'async_trait>>where
'life0: 'async_trait,
DefaultNode: 'async_trait,
Execute a run of this node.
Source§fn is_condition(&self) -> bool
fn is_condition(&self) -> bool
Return true if this node is conditional node. By default, it returns false.
Auto Trait Implementations§
impl !RefUnwindSafe for DefaultNode
impl !UnwindSafe for DefaultNode
impl Freeze for DefaultNode
impl Send for DefaultNode
impl Sync for DefaultNode
impl Unpin for DefaultNode
impl UnsafeUnpin for DefaultNode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
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