Module trait cleanups

This commit is contained in:
Matthias Beyer 2015-10-19 17:54:32 +02:00
parent 1d98cf7634
commit bff720018c
2 changed files with 23 additions and 12 deletions

View file

@ -1,12 +0,0 @@
use runtime::Runtime;
use std::error::Error;
pub trait Module {
fn load(&self, &rt : Runtime) -> Self;
fn name(&self) -> String;
fn execute(&self, &rt : Runtime) -> Option<Error>;
fn shutdown(&self, &rt : Runtime) -> Option<Error>;
}

23
src/module/mod.rs Normal file
View file

@ -0,0 +1,23 @@
pub use runtime::Runtime;
pub use std::error::Error;
pub use std::fs::Path;
pub use module::todo::TodoModule;
pub trait Module {
fn load(&self, &rt : Runtime) -> Option<Self>;
fn callnames() -> [String];
fn name(&self) -> String;
fn execute(&self, &rt : Runtime) -> Option<Error>;
fn shutdown(&self, &rt : Runtime) -> Option<Error>;
}
pub trait TouchingModule : Module {
fn load_with_path(&self, rt : &Runtime, path : &Path) -> Self;
}