pub trait CradlePlugin: Default + Send {
// Required methods
fn name(&self) -> &str;
fn results(&mut self) -> Vec<CheckResult>;
// Provided methods
fn init(&mut self, engine: CradleMutex<HookEngine>) -> CradleResult { ... }
fn on_event(&mut self, event: &AgentEvent<'_>) -> CradleResult { ... }
fn cleanup(&mut self) { ... }
}Expand description
Trait definition for a cradle plugin
Required Methods§
Sourcefn results(&mut self) -> Vec<CheckResult>
fn results(&mut self) -> Vec<CheckResult>
Returns the array of results (CheckResult)
Provided Methods§
Sourcefn init(&mut self, engine: CradleMutex<HookEngine>) -> CradleResult
fn init(&mut self, engine: CradleMutex<HookEngine>) -> CradleResult
Optional initialization function If your plugin needs to hook onto, or initialize stuff when the agent is being initialized, define this function
Sourcefn on_event(&mut self, event: &AgentEvent<'_>) -> CradleResult
fn on_event(&mut self, event: &AgentEvent<'_>) -> CradleResult
Optional event handling function
If your plugin checks things based on some event (specified by AgentEvent), then define this function
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".