Trait marid::Runner [] [src]

pub trait Runner {
    fn run(self: Box<Self>, signals: Receiver<Signal>) -> Result<(), MaridError>;
    fn setup(&mut self) -> Result<(), MaridError>;
}

A type implementing the Runner trait has the job of performing some arbitrary work while waiting for a signal indication shutdown. Upon receiving that defined shutdown Signal, the Runner must exit in a finite period of time.

Required Methods

fn run(self: Box<Self>, signals: Receiver<Signal>) -> Result<(), MaridError>

Performs work for an indefinite amount of time.

The Box form is used here in order to allow Process types the ability to run different types of Runners at once.

fn setup(&mut self) -> Result<(), MaridError>

Used to do any setup work necessary for the Runner.

This function should only complete once the type is ready to be run, and must complete in a finite period of time.

Implementors