macro_rules! entrypoint {
($init_fn:expr) => { ... };
}Expand description
Generates the _start function that will be called by Envoy to let
WebAssembly module initialize itself.
ยงExamples
use envoy::extension::{entrypoint, Module, Result};
entrypoint! { initialize } // put initialization logic into a function to make it unit testable
/// Does one-time initialization.
///
/// Returns a registry of extensions provided by this module.
fn initialize() -> Result<Module> {
// arbitrary initialization steps
Module::new()
.add_http_filter(|_instance_id| MyHttpFilterFactory::default())?
.add_network_filter(|_instance_id| MyNetworkFilterFactory::default())?
.add_access_logger(|_instance_id| MyAccessLogger::default())
}