move processors into const
This commit is contained in:
parent
8603dbcc77
commit
d4e46c3090
2 changed files with 8 additions and 5 deletions
|
@ -1,13 +1,10 @@
|
|||
use config::Config;
|
||||
|
||||
use processors::html_cleanup::html_cleanup;
|
||||
use processors::strip_blank::strip_blank;
|
||||
use processors::PROCESSORS;
|
||||
|
||||
pub fn render(config: Config, input: String) -> Result<String, String> {
|
||||
let mut rendered_input = input;
|
||||
let renderers: Vec<fn(Config, String) -> Result<String, String>> =
|
||||
vec![html_cleanup, strip_blank];
|
||||
for renderer in renderers {
|
||||
for renderer in PROCESSORS.into_iter() {
|
||||
rendered_input = try!(renderer(config.clone(), rendered_input));
|
||||
}
|
||||
return Ok(rendered_input);
|
||||
|
|
|
@ -1,2 +1,8 @@
|
|||
use config::Config;
|
||||
|
||||
pub mod html_cleanup;
|
||||
pub mod strip_blank;
|
||||
|
||||
|
||||
pub const PROCESSORS: [fn(Config, String) -> Result<String, String>; 2] =
|
||||
[html_cleanup::html_cleanup, strip_blank::strip_blank];
|
||||
|
|
Reference in a new issue