Trait rocket_dyn_templates::minijinja::value::ArgType

source ·
pub trait ArgType<'a> {
    type Output;
}
Expand description

A trait implemented by all filter/test argument types.

This trait is used by FunctionArgs. It’s implemented for many common types that are typically passed to filters, tests or functions. It’s implemented for the following types:

The type is also implemented for optional values (Option<T>) which is used to encode optional parameters to filters, functions or tests. Additionally it’s implemented for Rest<T> which is used to encode the remaining arguments of a function call.

§Notes on Borrowing

Note on that there is an important difference between String and &str: the former will be valid for all values and an implicit conversion to string via ToString will take place, for the latter only values which are already strings will be passed. A compromise between the two is Cow<'_, str> which will behave like String but borrows when possible.

Byte slices will borrow out of values carrying bytes or strings. In the latter case the utf-8 bytes are returned.

There are also further restrictions imposed on borrowing in some situations. For instance you cannot implicitly borrow out of sequences which means that for instance Vec<&str> is not a legal argument.

§Notes on State

When &State is used, it does not consume a passed parameter. This means that a filter that takes (&State, String) actually only has one argument. The state is passed implicitly.

Required Associated Types§

source

type Output

The output type of this argument.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> ArgType<'a> for &str

§

type Output = &'a str

source§

impl<'a> ArgType<'a> for &[u8]

§

type Output = &'a [u8]

source§

impl<'a> ArgType<'a> for &[Value]

§

type Output = &'a [Value]

source§

impl<'a> ArgType<'a> for Cow<'_, str>

§

type Output = Cow<'a, str>

source§

impl<'a> ArgType<'a> for bool

§

type Output = bool

source§

impl<'a> ArgType<'a> for char

§

type Output = char

source§

impl<'a> ArgType<'a> for f32

§

type Output = f32

source§

impl<'a> ArgType<'a> for f64

§

type Output = f64

source§

impl<'a> ArgType<'a> for i8

§

type Output = i8

source§

impl<'a> ArgType<'a> for i16

§

type Output = i16

source§

impl<'a> ArgType<'a> for i32

§

type Output = i32

source§

impl<'a> ArgType<'a> for i64

§

type Output = i64

source§

impl<'a> ArgType<'a> for i128

§

type Output = i128

source§

impl<'a> ArgType<'a> for u8

§

type Output = u8

source§

impl<'a> ArgType<'a> for u16

§

type Output = u16

source§

impl<'a> ArgType<'a> for u32

§

type Output = u32

source§

impl<'a> ArgType<'a> for u64

§

type Output = u64

source§

impl<'a> ArgType<'a> for u128

§

type Output = u128

source§

impl<'a> ArgType<'a> for usize

source§

impl<'a> ArgType<'a> for String

source§

impl<'a> ArgType<'a> for Arc<str>

§

type Output = Arc<str>

source§

impl<'a, T> ArgType<'a> for Option<T>
where T: ArgType<'a>,

§

type Output = Option<<T as ArgType<'a>>::Output>

source§

impl<'a, T> ArgType<'a> for Vec<T>
where T: ArgType<'a, Output = T>,

§

type Output = Vec<T>

Implementors§

source§

impl<'a> ArgType<'a> for &State<'_, '_>

§

type Output = &'a State<'a, 'a>

source§

impl<'a> ArgType<'a> for &Value

§

type Output = &'a Value

source§

impl<'a> ArgType<'a> for &dyn SeqObject

§

type Output = &'a dyn SeqObject

source§

impl<'a> ArgType<'a> for Value

source§

impl<'a> ArgType<'a> for Kwargs

source§

impl<'a, T> ArgType<'a> for Rest<T>
where T: ArgType<'a, Output = T>,

§

type Output = Rest<T>

source§

impl<'a, T> ArgType<'a> for ViaDeserialize<T>
where T: Deserialize<'a>,