Use plugin chain code in Vfs

This commit is contained in:
Lucien Greathouse
2017-12-18 01:52:08 -08:00
parent f90c51e923
commit 6ee9a48e20
4 changed files with 40 additions and 10 deletions

View File

@@ -18,11 +18,11 @@ pub trait Plugin {
}
pub struct PluginChain {
plugins: Vec<Box<Plugin + Send>>,
plugins: Vec<Box<Plugin + Send + Sync>>,
}
impl PluginChain {
pub fn new(plugins: Vec<Box<Plugin + Send>>) -> PluginChain {
pub fn new(plugins: Vec<Box<Plugin + Send + Sync>>) -> PluginChain {
PluginChain {
plugins,
}
@@ -38,4 +38,15 @@ impl PluginChain {
None
}
pub fn handle_file_change(&self, route: &Route) -> Option<Vec<Route>> {
for plugin in &self.plugins {
match plugin.handle_file_change(route) {
FileChangeResult::MarkChanged(changes) => return changes,
FileChangeResult::Pass => {},
}
}
None
}
}