[][src]Macro partial_application::partial

macro_rules! partial {
    (@inner [(() $id:expr) ($($cl_arg:ident),*) ($($fn_arg:expr),*)] ()) => { ... };
    (@inner [(move $id:expr) ($($cl_arg:ident),*) ($($fn_arg:expr),*)] ()) => { ... };
    (@inner [$pt:tt ($($cl_arg:ident),*) ($($fn_arg:expr),*)] (_ , $($m_arg:tt)*) ) => { ... };
    (@inner [$pt:tt ($($cl_arg:ident),*) ($($fn_arg:expr),*)] (_) ) => { ... };
    (@inner [$pt:tt $cl_args:tt ($($fn_arg:expr),*)] ($e:expr , $($m_arg:tt)*) ) => { ... };
    (@inner [$pt:tt $cl_args:tt ($($fn_arg:expr),*)] ($e:expr) ) => { ... };
    (move $id:expr , $($args:tt)*) => { ... };
    (move $id:expr ; $($args:tt)*) => { ... };
    (move $id:expr => $($args:tt)*) => { ... };
    ($id:expr , $($args:tt)*) => { ... };
    ($id:expr ; $($args:tt)*) => { ... };
    ($id:expr => $($args:tt)*) => { ... };
}

The macro that creates a wrapping closure for a partially applied function

Syntax: partial!(move? fn_name ("=>" | "," | ";") comma_separated_arg_list) =>, , and ; are completely equivalent and act only as separator between function and arguments.

Function arguments are either expressions or _
_ arguments have to be supplied on each call. They forward from the resulting closure into the function.
Expressions are hardcoded into the function call.
partial!(foo => _) => |a| foo(a);
partial!(foo => 2) => || foo(2);

Prepending move to the fn_name creates a move closure. Trailing commas are permitted.