pub trait DescribableFunction<PT: ProtocolTypes, Types> {
// Required methods
fn name(&'static self) -> &'static str;
fn shape() -> DynamicFunctionShape<PT>;
fn make_dynamic(&'static self) -> Box<dyn DynamicFunction<PT>>;
}Expand description
This trait is implemented for function traits in order to:
- describe their shape during runtime
- wrap them into a
DynamicFunctionwhich is callable with arbitrary data
Adapted from https://jsdw.me/posts/rust-fn-traits/ but using type ids
Required Methods§
fn name(&'static self) -> &'static str
fn shape() -> DynamicFunctionShape<PT>
fn make_dynamic(&'static self) -> Box<dyn DynamicFunction<PT>>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.