use super::FormatParser;
use function;
use metadata;
pub struct Formatter<T: metadata::Provider> {
functions: Vec<function::Function<T>>,
}
impl<T: metadata::Provider> Formatter<T> {
pub fn new() -> Formatter<T> {
let functions = function::standard_functions().collect();
Formatter { functions }
}
pub fn new_empty() -> Formatter<T> {
Formatter {
functions: Vec::new(),
}
}
pub fn functions(&self) -> &Vec<function::Function<T>> {
&self.functions
}
pub fn add_function(&mut self, func: function::Function<T>) {
self.functions.push(func);
}
pub fn parser(&self) -> FormatParser<T> {
FormatParser::new(self)
}
}