tera/builtins/filters/
mod.rsuse std::collections::HashMap;
use crate::errors::Result;
use serde_json::value::Value;
pub mod array;
pub mod common;
pub mod number;
pub mod object;
pub mod string;
pub trait Filter: Sync + Send {
fn filter(&self, value: &Value, args: &HashMap<String, Value>) -> Result<Value>;
fn is_safe(&self) -> bool {
false
}
}
impl<F> Filter for F
where
F: Fn(&Value, &HashMap<String, Value>) -> Result<Value> + Sync + Send,
{
fn filter(&self, value: &Value, args: &HashMap<String, Value>) -> Result<Value> {
self(value, args)
}
}