pub struct FunctionNode { /* private fields */ }Expand description
A node that runs a function. The constructors return it as Arc<dyn Node>.
Trait Implementations§
Source§impl Node for FunctionNode
impl Node for FunctionNode
Source§fn run(&self, ctx: Context, input: Value) -> EventStream
fn run(&self, ctx: Context, input: Value) -> EventStream
Runs the body. A plain body’s result becomes one event; an emitting body runs alongside the drain of the events it emits.
Source§fn description(&self) -> &str
fn description(&self) -> &str
The node’s human-readable description.
Source§fn config(&self) -> &NodeConfig
fn config(&self) -> &NodeConfig
The node’s configuration.
Source§fn input_schema(&self) -> Option<&Value>
fn input_schema(&self) -> Option<&Value>
None = no schema, no input validation.Source§fn output_schema(&self) -> Option<&Value>
fn output_schema(&self) -> Option<&Value>
None = no schema, no output validation.Source§fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_input(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler before
run on every activation.Source§fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
fn validate_output(&self, v: Value) -> Result<Value, WorkflowError>
Called by the scheduler on every yielded event with an output.
Source§fn state_field_names(&self) -> Option<&[String]>
fn state_field_names(&self) -> Option<&[String]>
The names of the state fields the node binds as parameters;
None = node does not bind
state params.Auto Trait Implementations§
impl !RefUnwindSafe for FunctionNode
impl !UnwindSafe for FunctionNode
impl Forget for FunctionNode
impl Freeze for FunctionNodewhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
*const ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send>>: Freeze,
*const ArcInner<CompiledSchema> is !null: Freeze,
PhantomData<ArcInner<CompiledSchema>>: Freeze,
*const ArcInner<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send>>: Freeze,
*const ArcInner<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send> is !null: Freeze,
PhantomData<ArcInner<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send>>: Freeze,
PhantomData<String>: Freeze,
impl Move for FunctionNode
impl Send for FunctionNodewhere
RawVecInner: Send,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Send,
Arc<CompiledSchema>: Send,
Arc<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send>: Send,
Arc<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send>: Send,
impl Sync for FunctionNodewhere
RawVecInner: Sync,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Sync,
Arc<CompiledSchema>: Sync,
Arc<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send>: Sync,
Arc<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send>: Sync,
impl Unpin for FunctionNodewhere
*const u8 is !null: Unpin,
Arc<dyn Fn(&AgentError) -> bool + Sync + Send>: Unpin,
Arc<CompiledSchema>: Unpin,
Arc<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send>: Unpin,
Arc<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send>: Unpin,
impl UnsafeUnpin for FunctionNodewhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
*const ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(&AgentError) -> bool + Sync + Send>>: UnsafeUnpin,
*const ArcInner<CompiledSchema> is !null: UnsafeUnpin,
PhantomData<ArcInner<CompiledSchema>>: UnsafeUnpin,
*const ArcInner<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(Context, Value) -> Pin<Box<dyn Future<Output = Result<FnOutput, AgentError>> + Send>> + Sync + Send>>: UnsafeUnpin,
*const ArcInner<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send> is !null: UnsafeUnpin,
PhantomData<ArcInner<dyn Fn(Context, Value, Arc<dyn Fn(Event) -> Pin<Box<dyn Future<Output = Result<(), AgentError>> + Send>> + Sync + Send>) -> Pin<Box<dyn Future<Output = Result<Option<Value>, AgentError>> + Send>> + Sync + Send>>: UnsafeUnpin,
PhantomData<String>: UnsafeUnpin,
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