Struct Executor

Source
pub struct Executor { /* private fields */ }
Expand description

The executor event loop and the set of registered tasks.

Implementations§

Source§

impl Executor

Source

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.

Source

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.

Source

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.

Source

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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.