macro_rules! cake_transform {
    ($description: expr, $fn_name: ident<$enum_name: ident, $err_type: ty>($($x: ident: $x_type: ident $(= $x_default_val: expr), *),*) -> $($out_type: ident),* $fn_block: block) => { ... };
}
Expand description

Create a new transform from a rust function.

Example

#[macro_use] extern crate variant_name_derive;
#[macro_use] extern crate aflak_cake;
use aflak_cake::*;

#[derive(Clone, PartialEq, Debug, VariantName)]
pub enum AlgoIO {
    Integer(u64),
    Image2d(Vec<Vec<f64>>),
}

pub enum E {}

let plus_one_trans = cake_transform!(
    "Long description of the transform",
// key identifying transformation   Input arguments with default value (optional)
//   \  In/Out types /- Error type  /        _ Output type(s)
//    \       /     / /------------/        /
    plus1<AlgoIO, E>(i: Integer = 0) -> Integer {
    // Define the body of the transformation.
    // Must return a Vec<Result<AlgoIO, !>>!
    vec![Ok(AlgoIO::Integer(i + 1))]
});