Add name method to Runnable trait

This commit is contained in:
Connor Brewster 2016-07-06 10:47:23 -06:00
parent d6f4dc06df
commit 54cf3afe30
2 changed files with 3 additions and 0 deletions

View file

@ -181,6 +181,8 @@ impl StorageEventRunnable {
}
impl Runnable for StorageEventRunnable {
fn name(&self) -> &'static str { "StorageEventRunnable" }
fn main_thread_handler(self: Box<StorageEventRunnable>, script_thread: &ScriptThread) {
let this = *self;
let storage_root = this.element.root();

View file

@ -200,6 +200,7 @@ impl<T: Runnable + Send> Runnable for CancellableRunnable<T> {
pub trait Runnable {
fn is_cancelled(&self) -> bool { false }
fn name(&self) -> &'static str { "generic runnable" }
fn handler(self: Box<Self>) {}
fn main_thread_handler(self: Box<Self>, _script_thread: &ScriptThread) { self.handler(); }
}