Macro exmex::ops_factory [−][src]
macro_rules! ops_factory {
($name : ident, $T : ty, $($ops : expr), *) => { ... };
}Expand description
This macro creates an operator factory struct that implements the trait
MakeOperators. You have to pass the name of the struct
as first, the type of the operands as second, and the Operators as
third to n-th argument.
Example
The following snippet creates a struct that can be used as in FlatEx<_, MyOpsFactory>.
use exmex::{MakeOperators, Operator, ops_factory};
ops_factory!(
MyOpsFactory, // name of struct
f32, // data type of operands
Operator::make_unary("log", |a| a.ln()),
Operator::make_unary("log2", |a| a.log2())
);