Struct rain_task::Executor [−][src]
pub struct Executor { /* fields omitted */ }
The executor event loop and the set of registered tasks.
Methods
impl Executor
[src]
impl Executor
pub fn new(executor_type: &str) -> Self
[src]
pub fn new(executor_type: &str) -> Self
Create a executor based on env variables RAIN_EXECUTOR_ID
and RAIN_EXECUTOR_SOCKET
and working dir in the current directory. See also Executor::with_params
.
Panics when either env variable is missing or invalid.
pub fn with_params(
executor_type: &str,
executor_id: ExecutorId,
socket_path: &Path,
working_dir: &Path
) -> Self
[src]
pub fn with_params(
executor_type: &str,
executor_id: ExecutorId,
socket_path: &Path,
working_dir: &Path
) -> Self
Creates a Sbgovernor with the given attributes. Note that the attributes are only recorded at this point and no initialization is performed.
pub fn register_task<S, F>(&mut self, task_name: S, task_fun: F) where
S: Into<String>,
F: 'static + Fn(&mut Context, &[DataInstance], &mut [Output]) -> TaskResult<()> + Send + Sync,
[src]
pub fn register_task<S, F>(&mut self, task_name: S, task_fun: F) where
S: Into<String>,
F: 'static + Fn(&mut Context, &[DataInstance], &mut [Output]) -> TaskResult<()> + Send + Sync,
Register task function.
The provided function must accept a list of inpts and outputs, expanding them manually.
For functions accepting individual inputs and outputs, see the macro register_task!
.
The accepted function type is equivalent to 'static + TaskFn
.
Panics when a task with the same name has been registered previously.
pub fn run(&mut self)
[src]
pub fn run(&mut self)
Run the executor loop, connecting to the governor, registering and handling requests until the connection is closed. May be only called once.
Panics on any error outside of the task functions. See README.md
for rationale.