pub struct WorkflowState {
pub outputs: HashMap<String, String>,
pub last: String,
}Expand description
Carrier for shared cross-step data. Append-only outputs map keyed
by step name; the latest emitted output is exposed as last.
Fields§
§outputs: HashMap<String, String>Per-step output strings, keyed by step name.
last: StringMost-recent emitted output.
Trait Implementations§
Source§impl Clone for WorkflowState
impl Clone for WorkflowState
Source§fn clone(&self) -> WorkflowState
fn clone(&self) -> WorkflowState
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkflowState
impl Debug for WorkflowState
Source§impl Default for WorkflowState
impl Default for WorkflowState
Source§fn default() -> WorkflowState
fn default() -> WorkflowState
Returns the “default value” for a type. Read more
Source§impl GraphState for WorkflowState
Manual GraphState impl: outputs keys overwrite; last replaces.
impl GraphState for WorkflowState
Manual GraphState impl: outputs keys overwrite; last replaces.
Source§type Update = WorkflowStateUpdate
type Update = WorkflowStateUpdate
Per-field-reducer-aware delta type.
Source§fn reset_ephemeral(&mut self)
fn reset_ephemeral(&mut self)
Reset any
#[reducer(ephemeral)] fields to Default::default().
The engine calls this at the start of every superstep, before
running tasks — so ephemeral fields hold only writes from the
current step. Default impl is a no-op for state types with no
ephemeral fields.Source§impl Runnable<String, WorkflowState> for Workflow
impl Runnable<String, WorkflowState> for Workflow
Source§fn invoke<'life0, 'async_trait>(
&'life0 self,
input: String,
__arg2: RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<WorkflowState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn invoke<'life0, 'async_trait>(
&'life0 self,
input: String,
__arg2: RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<WorkflowState>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
One-shot invocation. The hot path.
Source§fn batch<'life0, 'async_trait>(
&'life0 self,
inputs: Vec<I>,
config: RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<Vec<O>, CognisError>> + Send + 'async_trait>>
fn batch<'life0, 'async_trait>( &'life0 self, inputs: Vec<I>, config: RunnableConfig, ) -> Pin<Box<dyn Future<Output = Result<Vec<O>, CognisError>> + Send + 'async_trait>>
Run multiple inputs in parallel. Defaults to
buffer_unordered
honouring config.max_concurrency.Source§fn stream<'life0, 'async_trait>(
&'life0 self,
input: I,
config: RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<RunnableStream<O>, CognisError>> + Send + 'async_trait>>
fn stream<'life0, 'async_trait>( &'life0 self, input: I, config: RunnableConfig, ) -> Pin<Box<dyn Future<Output = Result<RunnableStream<O>, CognisError>> + Send + 'async_trait>>
Stream the final output (chunks of
O). Default emits one item via
invoke — non-streaming runnables are correct without override.Source§fn stream_events<'life0, 'async_trait>(
&'life0 self,
input: I,
config: RunnableConfig,
) -> Pin<Box<dyn Future<Output = Result<EventStream, CognisError>> + Send + 'async_trait>>
fn stream_events<'life0, 'async_trait>( &'life0 self, input: I, config: RunnableConfig, ) -> Pin<Box<dyn Future<Output = Result<EventStream, CognisError>> + Send + 'async_trait>>
Stream structured events. Default emits OnStart + OnEnd around an
invoke call. Graph engines override to surface per-node events.Source§fn input_schema(&self) -> Option<Value>
fn input_schema(&self) -> Option<Value>
JSON Schema for the input type, if known.
Source§fn output_schema(&self) -> Option<Value>
fn output_schema(&self) -> Option<Value>
JSON Schema for the output type, if known.
Auto Trait Implementations§
impl Freeze for WorkflowState
impl RefUnwindSafe for WorkflowState
impl Send for WorkflowState
impl Sync for WorkflowState
impl Unpin for WorkflowState
impl UnsafeUnpin for WorkflowState
impl UnwindSafe for WorkflowState
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