Attribute Macro quilkin::filter [−][src]
#[filter]
Expand description
An attribute procedural macro for defining filters.
The filter
attribute can be prepended to any struct, to automatically
import the protobuf runtime version that was defined with include_proto
,
and it defines an associated constant named FILTER_NAME
containing
the protobuf identifier.
A string literal representing the gRPC Protobuf name of the struct should always the first argument, followed by these optional keyword arguments for additional configuration.
-
root
sets the root of the path to import your Protobuf generated struct. default:self
. -
vis
sets the visibility of the associatedPROTOBUF_ID
constant. default:pub (crate)
.
The macro generates code that looks something like the following;
Input
#[quilkin::filter("quilkin.extensions.filters.debug.v1alpha1.Debug")] pub struct Debug;
Output
impl Debug { pub (crate) const FILTER_NAME: &str = "quilkin.extensions.filters.debug.v1alpha1.Debug"; }