Skip to main content

FlowRef

Struct FlowRef 

Source
pub struct FlowRef(/* private fields */);
Expand description

A wrapper around Arc<Flow> to support poem-openapi traits.

This wrapper exists to work around Rust’s orphan rules which prevent implementing external traits on external types like Arc<Flow>.

Implementations§

Source§

impl FlowRef

Source

pub fn new(flow: Flow) -> Self

Create a new FlowRef from a Flow.

Source

pub fn from_arc(arc: Arc<Flow>) -> Self

Create a new FlowRef from an Arc<Flow>.

Source

pub fn as_flow(&self) -> &Flow

Get a reference to the underlying Flow.

Source

pub fn into_arc(self) -> Arc<Flow>

Get the underlying Arc<Flow>.

Source

pub fn as_arc(&self) -> &Arc<Flow>

Get a reference to the underlying Arc<Flow>.

Methods from Deref<Target = Flow>§

Source

pub fn slow_clone(&self) -> Self

Create a clone of this flow.

Warning: This method performs a deep clone of the entire workflow structure, including all steps, metadata, and configurations. This can be expensive for large workflows.

§Performance
  • Cloning large workflows with many steps can be slow
  • Consider using Arc<Flow> for shared ownership instead
  • Only use this when you need to modify the workflow structure
§Example
use stepflow_core::workflow::Flow;

let original_flow = Flow::default();
let cloned_flow = original_flow.slow_clone();
Source

pub fn name(&self) -> Option<&str>

Source

pub fn description(&self) -> Option<&str>

Source

pub fn version(&self) -> Option<&str>

Source

pub fn metadata(&self) -> &HashMap<String, Value>

Source

pub fn steps(&self) -> &[Step]

Returns a reference to all steps in the flow.

Source

pub fn examples(&self) -> &[ExampleInput]

Source

pub fn variables(&self) -> Option<VariableSchema>

Get the variable schema for the flow.

This constructs a VariableSchema from the schema definition, extracting runtime metadata like defaults, secrets, and required variables.

Source

pub fn variable_schema(&self) -> Option<&SchemaRef>

Get a reference to the variable schema (raw SchemaRef).

Source

pub fn step(&self, index: usize) -> &Step

Returns a reference to the step at the given index.

§Panics

Panics if the index is out of bounds.

Source

pub fn output(&self) -> &ValueExpr

Returns a reference to the flow’s output value.

Source

pub fn test(&self) -> Option<&TestConfig>

Source

pub fn schemas(&self) -> &FlowSchema

Get the flow’s schema information.

Source

pub fn input_schema(&self) -> Option<&SchemaRef>

Get the flow’s input schema.

Source

pub fn output_schema(&self) -> Option<&SchemaRef>

Get the flow’s output schema.

Source

pub fn step_output_schema(&self, step_id: &str) -> Option<&SchemaRef>

Get the output schema for a specific step.

Source

pub fn get_all_examples(&self) -> Vec<ExampleInput>

Get all example inputs, including those derived from test cases.

Trait Implementations§

Source§

impl Clone for FlowRef

Source§

fn clone(&self) -> FlowRef

Returns a duplicate 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 FlowRef

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Deref for FlowRef

Source§

type Target = Flow

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'de> Deserialize<'de> for FlowRef

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl From<Arc<Flow>> for FlowRef

Source§

fn from(arc: Arc<Flow>) -> Self

Converts to this type from the input type.
Source§

impl From<Flow> for FlowRef

Source§

fn from(flow: Flow) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for FlowRef

Source§

fn eq(&self, other: &FlowRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for FlowRef

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for FlowRef

Auto Trait Implementations§

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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where 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 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

Source§

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 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> Erased for T