WIP Impl Action

This commit is contained in:
Adrian Heine 2017-07-28 22:46:40 +02:00
parent 23fed5b6ca
commit b8bac1142c
28 changed files with 363 additions and 58 deletions

View file

@ -5,7 +5,7 @@ use std::io;
use std::path::Path;
use resources::Resource;
use symbols::Symbol;
use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
pub struct Dir<D> where D: AsRef<str> + fmt::Display {
path: D
@ -50,6 +50,14 @@ impl<D> Symbol for Dir<D> where D: AsRef<str> + fmt::Display {
fn provides(&self) -> Option<Vec<Resource>> {
Some(vec![ Resource::new("dir", self.path.to_string()) ])
}
fn as_action<'a>(&'a self, runner: &'a SymbolRunner) -> Box<Action + 'a> {
Box::new(SymbolAction::new(runner, self))
}
fn into_action<'a>(self: Box<Self>, runner: &'a SymbolRunner) -> Box<Action + 'a> where Self: 'a {
Box::new(OwnedSymbolAction::new(runner, *self))
}
}
impl<D> fmt::Display for Dir<D> where D: AsRef<str> + fmt::Display {