Struct steno::Node

source ·
pub struct Node { /* private fields */ }
Expand description

Describes a node in the saga DAG

There are three kinds of nodes you can add to a graph:

  • an action (see Node::action), which executes a particular Action with an associated undo action
  • a constant (see Node::constant), which is like an action that outputs a value that’s known when the DAG is constructed
  • a subsaga (see Node::subsaga), which executes another DAG in the context of this saga

Each of these node types has a node_name and produces an output. Other nodes that depend on this node (directly or indirectly) can access the output by looking it up by the node name using crate::ActionContext::lookup:

  • The output of an action node is emitted by the action itself.
  • The output of a constant node is the value provided when the node was created (see Node::constant).
  • The output of a subsaga node is the output of the subsaga itself. Note that the output of individual nodes from the subsaga DAG is not available to other nodes in this DAG. Only the final output is available.

Implementations§

source§

impl Node

source

pub fn action<N: AsRef<str>, L: AsRef<str>, A: SagaType>( node_name: N, label: L, action: &dyn Action<A> ) -> Node

Make a new action node (see Node)

This node is used to execute the given action. The action’s output will be available to dependent nodes by looking up the name node_name. See Action for more information.

source

pub fn constant<N: AsRef<str>>(node_name: N, value: Value) -> Node

Make a new constant node (see Node)

This node immediately emits value. Why would you want this? Suppose you’re working with some saga action that expects input to come from some previous saga node. But in your case, you know the input up front. You can use this to provide the value to the downstream action.

source

pub fn subsaga<N1: AsRef<str>, N2: AsRef<str>>( node_name: N1, dag: Dag, params_node_name: N2 ) -> Node

Make a new subsaga node (see Node)

This is used to insert a subsaga into another saga. The output of the subsaga will have name node_name in the outer saga. The subsaga’s DAG is described by dag. Its input parameters will come from node params_node_name in the outer saga.

Trait Implementations§

source§

impl Clone for Node

source§

fn clone(&self) -> Node

Returns a copy 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 Node

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Node

§

impl Send for Node

§

impl Sync for Node

§

impl Unpin for Node

§

impl UnwindSafe for Node

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> DynClone for Twhere T: Clone,

source§

fn __clone_box(&self, _: Private) -> *mut ()

source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere 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 Twhere T: Clone,

§

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 Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
source§

impl<T> SendSyncUnwindSafe for Twhere T: Send + Sync + UnwindSafe + ?Sized,