Skip to main content

Flow

Struct Flow 

Source
pub struct Flow { /* private fields */ }
Expand description

A compiled flow. Compile it once with Flow::compile, store it with Flow::to_bytes and load it with Flow::from_bytes. It is immutable and can be shared between threads.

Implementations§

Source§

impl Flow

Source

pub fn to_bytes(&self) -> Vec<u8> ⓘ

The flow as bytes to store. They hold the source, which from_bytes compiles again.

Source

pub fn from_bytes(bytes: &[u8]) -> Result<Flow, LoadError>

Load a flow saved with to_bytes. Any damaged byte is refused, and the source must compile to the hash saved with it.

Source§

impl Flow

Source

pub fn compile(src: &str) -> Result<Flow, Diagnostics>

Compile a .flow source. On success the flow may still carry warnings.

Source

pub fn check(src: &str) -> Diagnostics

Every error and warning in a source, without keeping the result.

Source§

impl Flow

Source

pub fn name(&self) -> &str

The name after flow.

Source

pub fn edition(&self) -> u32

The language edition the flow is written in.

Source

pub fn hash(&self) -> String

The flow’s version as hex. It changes when what the flow does changes, and not when only its layout, comments or annotations do.

Source

pub fn entries(&self) -> impl Iterator<Item = &str>

The nodes a new run may start at.

Source

pub fn events(&self) -> impl Iterator<Item = &str>

Declared events. tick is always accepted too.

Source

pub fn params(&self) -> &[Param]

Params in declaration order, with their defaults.

Source

pub fn asks(&self) -> impl Iterator<Item = &str>

Every ask name the flow can produce, e.g. to check that the host resolves each of them before deploying.

Source

pub fn annotations(&self) -> &[Annotation]

The annotations on the flow declaration.

Source

pub fn warnings(&self) -> &[Diagnostic]

Problems that didn’t stop the flow compiling.

Source

pub fn nodes(&self) -> impl Iterator<Item = NodeInfo<'_>>

Every node, in source order.

Source

pub fn node(&self, name: &str) -> Option<NodeInfo<'_>>

The node called name.

Source

pub fn source(&self) -> &str

The source the flow was compiled from, for reports such as RunError::report.

Source§

impl Flow

Source

pub fn rebind(&self, token: &Token) -> Result<Token, RebindError>

Move a token to this version of the flow: its node must still exist, take as many arguments, and continue an ask exactly when the token waits on one, and each param it carries must still exist. The instance stays where it was, with the same sequence number.

Arguments travel by position, so a node whose parameters were renamed or reordered takes them as they were. The host decides when rebinding is safe, e.g. after fixing a flow that failed mid-instance.

Source§

impl Flow

Source

pub fn run(&self, input: Input, limits: &Limits) -> Result<Decision, InputError>

Run the flow once. Err means the host passed something wrong and nothing ran; every other ending is a Decision.

Source

pub fn run_traced( &self, input: Input, limits: &Limits, ) -> Result<(Decision, Trace), InputError>

Like run, also returning the path the run took.

Trait Implementations§

Source§

impl Clone for Flow

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Flow

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Flow

§

impl RefUnwindSafe for Flow

§

impl Send for Flow

§

impl Sync for Flow

§

impl Unpin for Flow

§

impl UnsafeUnpin for Flow

§

impl UnwindSafe for Flow

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> 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> 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<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> 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 = !

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.