Skip to main content

CradlePlugin

Trait CradlePlugin 

Source
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§

Source

fn name(&self) -> &str

Name of the plugin

Source

fn results(&mut self) -> Vec<CheckResult>

Returns the array of results (CheckResult)

Provided Methods§

Source

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

Source

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

Source

fn cleanup(&mut self)

Optional plugin cleanup function

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§