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) -> Kwargs
impl Debug for Kwargs
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for Kwargs
fn default() -> Kwargs
impl<const N: usize> From<[(&'static str, Value); N]> for Kwargs
fn from(pairs: [(&'static str, Value); N]) -> Self
Auto Trait Implementations
impl Freeze for Kwargs
impl RefUnwindSafe for Kwargs
impl Send for Kwargs
impl Sync for Kwargs
impl Unpin for Kwargs
impl UnsafeUnpin for Kwargs
impl UnwindSafe for Kwargs
Blanket Implementations
impl<T> Any for Kwargs
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Kwargs
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Kwargs
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for Kwargs
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for Kwargs
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for Kwargs
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for Kwargs
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Kwargs
where
U: Into<T>,
type Error = Infallible;fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto<U> for Kwargs
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>