Struct Kwargs
pub struct Kwargs { /* private fields */ }
The keyword arguments of a filter/function
Implementations
impl Kwargs
fn new(map: Arc<Map>) -> SelfCreates a new Kwargs struct from a Map. The Map is Arc<_> since internally that's what we have.
fn deserialize<'a, T: Deserialize<'a>>(&'a self) -> TeraResult<T>Deserialize the kwargs into something that impl Deserialize
fn get<'k, T>(&'k self, key: &'k str) -> TeraResult<Option<T>> where T: ArgFromValue<'k, Output = T>,Try to get the given key value and convert it to the given type Returns None if not found
fn must_get<'k, T>(&'k self, key: &'k str) -> TeraResult<T> where T: ArgFromValue<'k, Output = T>,Try to get the given key value. Returns an error if not found.
fn iter(&self) -> impl Iterator<Item = (&Key<'static>, &Value)>Iterates over all the provided arguments. Order is not guaranteed unless the "preserve_order" feature is set.
Trait Implementations
impl Clone for Kwargs
fn clone(&self) -> Self
impl Debug for Kwargs
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Kwargs
fn default() -> Self
impl<const N: usize> From<[(&'static str, Value); N]> for Kwargs
fn from(pairs: [(&'static str, Value); N]) -> Self