Macro rain_task::register_task [−][src]
macro_rules! register_task { ($executor: expr, $name: expr, [$($params: tt)*], $taskfn: expr) => { ... }; }
Register a given task function with complex arguments with the executor.
The task function should take individual input and output parameters as specified by $params
.
On call, the supplied input and output lists are unpacked, both not enough and too many of each
parameter kinds is raised as a task error.
$params
are surrounded with []
and may contain:
I
- a single&Datainstance
.Is
- all the remaining inputs as&[Datainstance]
.O
- a single&mut Output
.Os
- all the remaining outputs as&mut [Output]
.
Examples
ⓘThis example is not tested
// Simple task with 2 inputs and 1 output (notice the freedom in arg order). fn task_hello(_ctx: &mut Context, in1: &DataInstance, out: &mut Output, in2: &DataInstance) -> TaskResult<()> { ... } // Register with: register_task!(s, "hello", [I O I], task_hello);
ⓘThis example is not tested
// Task with one input, then arbitrarily many remaining inputs and one output fn task_concat(_ctx: &mut Context, separator: &DataInstance, ins: &[DataInstance], out: &mut Output) -> TaskResult<()> { ... } // Register with: register_task!(s, "hello", [I Is O], task_hello);