pub trait DynamicFunction: Fn(&Vec<Box<dyn Any>>) -> Result<Box<dyn Any>, FnError> + Send + Sync {
    fn clone_box(&self) -> Box<dyn DynamicFunction>;
}
Expand description

Cloneable type for dynamic functions. This trait is automatically implemented for arbitrary closures and functions of the form: Fn(&Vec<Box<dyn Any>>) -> Box<dyn Any>

Clone is implemented for Box<dyn DynamicFunction> using this trick: https://users.rust-lang.org/t/how-to-clone-a-boxed-closure/31035/25

We want to use Any here and not VariableData (which implements Clone). Else all returned types in functions op_impl.rs would need to return a cloneable struct. Message for example is not.

Required Methods§

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more

Implementors§