Trait erin::Process

source ·
pub trait Process: Send + 'static {
    // Required method
    fn wakeup(
        &mut self,
        handle: &RuntimeHandle<'_>,
        events: Events<'_>
    ) -> Result<(), Exit>;

    // Provided methods
    fn setup(&mut self, _handle: &RuntimeHandle<'_>) -> Result<(), Exit> { ... }
    fn shutdown(&mut self) { ... }
}
Expand description

A process that can be run in erin’s Runtime.

Required Methods§

source

fn wakeup( &mut self, handle: &RuntimeHandle<'_>, events: Events<'_> ) -> Result<(), Exit>

This function is called when an event happened that the process is interested in. Use the handle to register/deregister for new events. This method should return an error if the process should exit.

Provided Methods§

source

fn setup(&mut self, _handle: &RuntimeHandle<'_>) -> Result<(), Exit>

Called when the process is added to the runtime.

Allows the process to register initial I/O sources and timers. This method should return an error if the process should exit.

The default implementation of this is empty.

source

fn shutdown(&mut self)

Called on shutdown.

The process object will be dropped right after this call and can be left in a broken state.

Note that it is not required to deregister I/O sources, the runtime will do that automatically.

This method is not called when [wakeup] or [setup] return an error.

The default implementation of this is empty.

Implementors§