Struct flowcore::model::function_definition::FunctionDefinition
source · 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
impl FunctionDefinition
sourcepub 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
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
sourcepub 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<()>
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
sourcepub fn get_flow_id(&self) -> usize
pub fn get_flow_id(&self) -> usize
Get the id of the low this function is a part of
sourcepub fn get_inputs(&self) -> &IOSet
pub fn get_inputs(&self) -> &IOSet
Get a reference to the set of inputs of this function
sourcepub fn get_mut_inputs(&mut self) -> &mut IOSet
pub fn get_mut_inputs(&mut self) -> &mut IOSet
Get a mutable reference to the set of inputs of this function
sourcepub fn get_outputs(&self) -> IOSet
pub fn get_outputs(&self) -> IOSet
Get a reference to the set of outputs this function generates
sourcepub fn add_output_connection(&mut self, output_route: OutputConnection)
pub fn add_output_connection(&mut self, output_route: OutputConnection)
Add a connection from this function to another
sourcepub fn get_output_connections(&self) -> &Vec<OutputConnection>
pub fn get_output_connections(&self) -> &Vec<OutputConnection>
Get a reference to the set of output connections from this function to others
sourcepub fn get_implementation(&self) -> &str
pub fn get_implementation(&self) -> &str
Get a reference to the implementation of this function
sourcepub fn set_implementation(&mut self, implementation: &str)
pub fn set_implementation(&mut self, implementation: &str)
Set the implementation location of this function
sourcepub fn set_source(&mut self, source: &str)
pub fn set_source(&mut self, source: &str)
Set the source field of the function
sourcepub fn get_source(&self) -> &str
pub fn get_source(&self) -> &str
Get the name of the source file relative to the function definition
sourcepub fn get_source_url(&self) -> &Url
pub fn get_source_url(&self) -> &Url
Get the source url for the file where this function was defined
sourcepub fn set_flow_initializer(
&mut self,
io_number: usize,
flow_initializer: Option<InputInitializer>
) -> Result<()>
pub fn set_flow_initializer( &mut self, io_number: usize, flow_initializer: Option<InputInitializer> ) -> Result<()>
Set a flow initializer on the specified input
sourcepub fn get_lib_reference(&self) -> &Option<Url>
pub fn get_lib_reference(&self) -> &Option<Url>
Get the lib reference of this function
sourcepub fn get_context_reference(&self) -> &Option<Url>
pub fn get_context_reference(&self) -> &Option<Url>
Get the context reference of this function
sourcepub fn camel_case(original: &str) -> String
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
impl Clone for FunctionDefinition
source§fn clone(&self) -> FunctionDefinition
fn clone(&self) -> FunctionDefinition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more