Module macros

Source
Available on crate feature macros only.
Expand description

Macros for simplifying Query and Plugin trait implementations

Macros§

queries
Generates an implementation of the Plugin::queries() trait function using all previously-expanded #[query] attribute macros. Due to Rust’s macro expansion ordering, all #[query] functions must come before this macro to ensure they are seen and added.

Attribute Macros§

query
An attribute on a function that creates an associated struct that implements the Hipcheck Rust SDK’s Query trait. The function must have the signature fn(&mut PluginEngine, content: impl serde::Deserialize) -> hipcheck_sdk::Result<impl serde::Serialize>. The generated struct’s name is the pascal-case version of the function name (e.g. do_something() -> DoSomething).

Derive Macros§

PluginConfig
Generates a derived macro implementation of the PluginConfig trait to deserialize each plugin config field derived from the Policy File. Config-related errors are handled by the ConfigError crate to generate specific error messages that detail the plugin, field, and type expected from the Policy File.