Function tera_rand::random_bool
source · pub fn random_bool(_args: &HashMap<String, Value>) -> Result<Value>Expand description
A Tera function to generate a random boolean.
Example usage
ⓘ
use tera::{Context, Tera};
use tera_rand::random_bool;
let mut tera: Tera = Tera::default();
tera.register_function("random_bool", random_bool);
let context: Context = Context::new();
let rendered: String = tera.render_str("{{ random_bool() }}", &context).unwrap();