Generated from cargo doc --no-deps -p nemo-relay -p nemo-relay-adaptive -p nemo-relay-ffi.
pub trait Plugin:
Send
+ Sync
+ 'static {
// Required methods
fn plugin_kind(&self) -> &str;
fn validate(
&self,
plugin_config: &Map<String, Json>,
) -> Vec<ConfigDiagnostic>;
fn register<'a>(
&'a self,
plugin_config: &Map<String, Json>,
ctx: &'a mut PluginRegistrationContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>;
// Provided method
fn allows_multiple_components(&self) -> bool { ... }
}
Implemented by custom plugins that register runtime middleware.
plugin_kindfn plugin_kind(&self) -> &str
Returns the unique plugin kind string.
validatefn validate(&self, plugin_config: &Map<String, Json>) -> Vec<ConfigDiagnostic>
Validates one plugin component config.
Returning error-level diagnostics prevents initialize_plugins(...) from activating the configuration.
registerfn register<'a>(
&'a self,
plugin_config: &Map<String, Json>,
ctx: &'a mut PluginRegistrationContext,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'a>>
Registers runtime middleware/subscribers for one plugin component.
The provided PluginRegistrationContext is component-scoped. Any error aborts the current initialization and triggers rollback of registrations created during the failed activation attempt.
allows_multiple_componentsfn allows_multiple_components(&self) -> bool
Returns whether the plugin kind can appear multiple times in the config.
Return false for singleton components such as the built-in adaptive component.