Crate rain_task[−][src]
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 |
Structs
Context |
State of the processed Task instance and its specification. |
DataInstance |
One instance of input |
DataObjectId |
ID type for task objects. |
Executor |
The executor event loop and the set of registered tasks. |
ObjectInfo | |
ObjectSpec | |
Output |
One instance of output |
Resources | |
TaskError |
A string error for the task functions. |
TaskId |
ID type for task objects. |
TaskInfo | |
TaskSpec | |
TaskSpecInput |
Enums
DataType |
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 Definitions
TaskFn |
Alias type for a executor task function with arbitrary number of inputs and outputs. |
TaskResult |
A |
UserValue |