Module trait: Module must be able to lend a Runtime object

This commit is contained in:
Matthias Beyer 2016-01-02 19:04:55 +01:00
parent 7cd429fe7e
commit 6d02e3d486
3 changed files with 12 additions and 0 deletions

View file

@ -380,6 +380,10 @@ impl<'a> Module<'a> for BM<'a> {
fn name(&self) -> &'static str { fn name(&self) -> &'static str {
"bookmark" "bookmark"
} }
fn runtime(&self) -> &Runtime {
self.rt
}
} }
impl<'a> Debug for BM<'a> { impl<'a> Debug for BM<'a> {

View file

@ -2,6 +2,8 @@ use std::fmt::Debug;
use clap::ArgMatches; use clap::ArgMatches;
use runtime::Runtime;
pub mod bm; pub mod bm;
pub mod helpers; pub mod helpers;
pub mod notes; pub mod notes;
@ -12,5 +14,7 @@ pub mod notes;
pub trait Module<'a> : Debug { pub trait Module<'a> : Debug {
fn exec(&self, matches: &ArgMatches) -> bool; fn exec(&self, matches: &ArgMatches) -> bool;
fn name(&self) -> &'static str; fn name(&self) -> &'static str;
fn runtime(&self) -> &Runtime;
} }

View file

@ -189,6 +189,10 @@ impl<'a> Module<'a> for Notes<'a> {
"notes" "notes"
} }
fn runtime(&self) -> &Runtime {
self.rt
}
} }
impl<'a> Debug for Notes<'a> { impl<'a> Debug for Notes<'a> {