Skip to main content

FunctionNode

Struct FunctionNode 

Source
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

Source§

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 name(&self) -> &str

The node’s name, unique within a workflow graph.
Source§

fn description(&self) -> &str

The node’s human-readable description.
Source§

fn config(&self) -> &NodeConfig

The node’s configuration.
Source§

fn input_schema(&self) -> Option<&Value>

None = no schema, no input validation.
Source§

fn output_schema(&self) -> Option<&Value>

None = no schema, no output validation.
Source§

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>

Called by the scheduler on every yielded event with an output.
Source§

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

fn as_any(&self) -> &dyn Any

Downcasting support, to tell concrete node types apart.

Auto Trait Implementations§

§

impl !RefUnwindSafe for FunctionNode

§

impl !UnwindSafe for FunctionNode

§

impl Forget for FunctionNode

§

impl Freeze for FunctionNode
where *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 FunctionNode
where 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 FunctionNode
where 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 FunctionNode
where *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 FunctionNode
where *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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more