[−][src]Derive Macro liquid_derive::ParseFilter
#[derive(ParseFilter)] { // Attributes available to this derive: #[filter] }
Implements ParseFilter
.
This is only useful for stateless filters (the most common case). For filters with configurable state, you will need to implement this trait manually.
Requires the #[filter(...)]
attribute to define the filter, with the
following information:
- parameters
-> (OPTIONAL) only required if the filter has parameters,
the FilterParameters
struct
- parsed
-> the Filter
struct
Example
ⓘThis example is not tested
#[derive(Clone, ParseFilter, FilterReflection)] #[filter( name = "slice", // Required by `FilterReflection`, not `ParseFilter` description = "Takes a slice of a given string or array.", // Required by `FilterReflection`, not `ParseFilter` parameters(SliceArgs), // The filter has parameters parsed(SliceFilter) )] pub struct Slice;