diff --git a/src/module/command.rs b/src/module/command.rs new file mode 100644 index 00000000..e83ce232 --- /dev/null +++ b/src/module/command.rs @@ -0,0 +1,11 @@ +use std::result::Result; + +use super::ModuleError; +use storage::backend::{StorageBackend, StorageBackendError}; + +type CommandError = Result; +type CommandResult = Result<(), Result>; + +pub trait ExecutableCommand { + fn exec(StorageBackend) -> CommandResult; +} diff --git a/src/module/mod.rs b/src/module/mod.rs index d0f711f2..2cc5aeb9 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -7,6 +7,7 @@ use std::path::Path; use std::result::Result; use storage::backend::{StorageBackend, StorageBackendError}; +use self::command::ExecutableCommand; mod command; #[derive(Debug)] @@ -51,7 +52,7 @@ pub trait Module { fn execute(&self, rt : &Runtime) -> ModuleResult; fn shutdown(&self, rt : &Runtime) -> ModuleResult; - fn getCommandBuilder() -> F + fn getCommandBuilder() -> F where F: FnOnce(StorageBackend) -> T, T: ExecutableCommand;