Expand description
A library to easily write custom Rain tasks in Rust.
See README.md
and the project page
for more information.
§Example
#[macro_use] // For register_task! if you want to use it
extern crate rain_task;
use rain_task::*;
use std::io::Write;
// A task with a single input and single output
fn task_hello(_ctx: &mut Context, input: &DataInstance, output: &mut Output) -> TaskResult<()> {
write!(output, "Hello {}", input.get_str()?)?;
Ok(())
}
fn main() {
let mut s = Executor::new("greeter"); // The executor type name
// Use a macro to register the task.
// [I O] here specifies the type and order of parameters.
register_task!(s, "hello", [I O], task_hello);
s.run(); // Runs the executor event loop
}
Macros§
- register_
task - Register a given task function with complex arguments with the executor.
- register_
task_ make_ call - Internal macro used in
register_task!
.
Structs§
- Context
- State of the processed Task instance and its specification.
- Data
Instance - One instance of input
DataObject
. - Data
Object Id - ID type for task objects.
- Executor
- The executor event loop and the set of registered tasks.
- Object
Info - Object
Spec - Output
- One instance of output
DataObject
. - Resources
- Task
Error - A string error for the task functions.
- TaskId
- ID type for task objects.
- Task
Info - Task
Spec - Task
Spec Input
Enums§
Constants§
- MAX_
MSG_ SIZE - Maximal protocol message size (128 MB)
- MEM_
BACKED_ LIMIT - Size limit for memory-backed objects. Larger blobs get written to the filesystem.
- MSG_
PROTOCOL - Current protocol code name and magic string
Type Aliases§
- TaskFn
- Alias type for a executor task function with arbitrary number of inputs and outputs.
- Task
Result - A
Result
withTaskError
. - User
Value