Module trait cleanups
This commit is contained in:
parent
1d98cf7634
commit
bff720018c
2 changed files with 23 additions and 12 deletions
|
@ -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
23
src/module/mod.rs
Normal 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;
|
||||
|
||||
}
|
||||
|
Loading…
Reference in a new issue