pub struct FunctionDefinition {
Show 14 fields pub name: Name, pub impure: bool, pub source: String, pub docs: String, pub build_type: String, pub inputs: IOSet, pub outputs: IOSet, pub alias: Name, pub source_url: Url, pub route: Route, pub implementation: String, pub lib_reference: Option<Url>, pub context_reference: Option<Url>, pub output_connections: Vec<OutputConnection>, /* private fields */
}
Expand description

FunctionDefinition defines a Function (compile time) that implements some processing in the flow hierarchy

Fields§

§name: Name

Name of the function

§impure: bool

Is this an impure function that interacts with the environment

§source: String

Name of the source file for the function implementation

§docs: String

Name of any docs file associated with this Function

§build_type: String

Type of build used to compile Function’s implementation to WASM from source

§inputs: IOSet

The set of inputs this function has

§outputs: IOSet

The set of outputs this function generates when executed

§alias: Name

As a function can be used multiple times in a single flow, the repeated instances must be referred to using an alias to disambiguate which instance is being referred to

§source_url: Url

source_url is where this function definition was read from

§route: Route

the route in the flow hierarchy where this function is located

§implementation: String

Implementation is the relative path from the lib root to the compiled wasm implementation

§lib_reference: Option<Url>

Is the function being used part of a library and where is it found

§context_reference: Option<Url>

Is the function a context function and where is it found

§output_connections: Vec<OutputConnection>

The output connections from this function to other processes (functions or flows)

Implementations§

source§

impl FunctionDefinition

source

pub fn new( name: Name, impure: bool, source: String, alias: Name, inputs: IOSet, outputs: IOSet, source_url: Url, route: Route, lib_reference: Option<Url>, context_reference: Option<Url>, output_connections: Vec<OutputConnection>, id: usize, flow_id: usize ) -> Self

Create a new function - used mainly for testing as Functions are usually deserialized

source

pub fn config( &mut self, original_url: &Url, source_url: &Url, parent_route: &Route, alias: &Name, flow_id: usize, reference: Option<Url>, initializations: &BTreeMap<String, InputInitializer> ) -> Result<()>

Configure a function with additional information after it is deserialized as part of a flow

source

pub fn set_id(&mut self, id: usize)

Set the id of this function

source

pub fn get_id(&self) -> usize

Get the id of this function

source

pub fn get_docs(&self) -> &str

Get the name of any associated docs file

source

pub fn get_flow_id(&self) -> usize

Get the id of the low this function is a part of

source

pub fn is_impure(&self) -> bool

Return true if this function is impure or not

source

pub fn get_inputs(&self) -> &IOSet

Get a reference to the set of inputs of this function

source

pub fn get_mut_inputs(&mut self) -> &mut IOSet

Get a mutable reference to the set of inputs of this function

source

pub fn get_outputs(&self) -> IOSet

Get a reference to the set of outputs this function generates

source

pub fn add_output_connection(&mut self, output_route: OutputConnection)

Add a connection from this function to another

source

pub fn get_output_connections(&self) -> &Vec<OutputConnection>

Get a reference to the set of output connections from this function to others

source

pub fn get_implementation(&self) -> &str

Get a reference to the implementation of this function

source

pub fn set_implementation(&mut self, implementation: &str)

Set the implementation location of this function

source

pub fn set_source(&mut self, source: &str)

Set the source field of the function

source

pub fn get_source(&self) -> &str

Get the name of the source file relative to the function definition

source

pub fn get_source_url(&self) -> &Url

Get the source url for the file where this function was defined

source

pub fn set_flow_initializer( &mut self, io_number: usize, flow_initializer: Option<InputInitializer> ) -> Result<()>

Set a flow initializer on the specified input

source

pub fn get_lib_reference(&self) -> &Option<Url>

Get the lib reference of this function

source

pub fn get_context_reference(&self) -> &Option<Url>

Get the context reference of this function

source

pub fn camel_case(original: &str) -> String

Convert a FunctionDefinition filename into the name of the struct used to implement it by removing underscores and camel case each word Example ’‘duplicate_rows’ -> ‘DuplicateRows’

Trait Implementations§

source§

impl Clone for FunctionDefinition

source§

fn clone(&self) -> FunctionDefinition

Returns a copy 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 FunctionDefinition

source§

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

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

impl Default for FunctionDefinition

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for FunctionDefinition

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 Display for FunctionDefinition

source§

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

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

impl HasName for FunctionDefinition

source§

fn name(&self) -> &Name

Return a reference to the name of the struct implementing this trait
source§

fn alias(&self) -> &Name

Return a reference to the alias (also a Name type) of the struct implementing this trait
source§

impl HasRoute for FunctionDefinition

source§

fn route(&self) -> &Route

Return a reference to the Route of the struct that implements this trait
source§

fn route_mut(&mut self) -> &mut Route

Return a mutable reference to the Route of the struct that implements this trait
source§

impl Serialize for FunctionDefinition

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 SetRoute for FunctionDefinition

source§

fn set_routes_from_parent(&mut self, parent_route: &Route)

Set the routes in fields of this struct based on the route of it’s parent.
source§

impl Validate for FunctionDefinition

source§

fn validate(&self) -> Result<()>

Validate that a deserialized model data structure is valid for use

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. 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 Twhere 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> ToOwned for Twhere T: Clone,

§

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> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

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

§

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 Twhere U: TryFrom<T>,

§

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