Module should only provide functionality to get a list of commands it can execute

These commands can then be executed.
This commit is contained in:
Matthias Beyer 2015-11-24 19:54:37 +01:00
parent 86286cce1b
commit cbd85b3d8e
2 changed files with 3 additions and 6 deletions

View File

@ -7,5 +7,6 @@ type CommandError = Result<ModuleError, StorageBackendError>;
type CommandResult = Result<(), Result<ModuleError, CommandError>>;
pub trait ExecutableCommand {
fn exec(StorageBackend) -> CommandResult;
fn get_callname() -> &'static str;
fn exec(&self, rt: &Runtime, s: StorageBackend) -> CommandResult;
}

View File

@ -49,13 +49,9 @@ pub trait Module {
fn new(rt : &Runtime) -> Self;
fn callnames() -> &'static [&'static str];
fn name(&self) -> &'static str;
fn execute(&self, rt : &Runtime) -> ModuleResult;
fn shutdown(&self, rt : &Runtime) -> ModuleResult;
fn getCommandBuilder<T, F>() -> F
where F: FnOnce(StorageBackend) -> T,
T: ExecutableCommand;
fn get_commands<C: ExecutableCommand>(&self, rt: &Runtime) -> Vec<C>;
}