pub trait Guest {
// Required methods
fn init() -> Result<Capabilities, InitError>;
fn info() -> PluginInfo;
fn handle(request: PluginRequest) -> HandleResult;
fn shutdown();
}Required Methods§
Sourcefn init() -> Result<Capabilities, InitError>
fn init() -> Result<Capabilities, InitError>
Initialize the plugin with provided configuration. Called once when the plugin is loaded. Returns capabilities the plugin requires.
The plugin should:
- Read any required configuration
- Initialize internal state
- Return the capabilities it needs
If initialization fails, the plugin will not be loaded.
Sourcefn info() -> PluginInfo
fn info() -> PluginInfo
Return plugin metadata. Called after successful initialization. This information is used for logging, metrics, and management.
Sourcefn handle(request: PluginRequest) -> HandleResult
fn handle(request: PluginRequest) -> HandleResult
Handle an incoming request. Called for each request that matches the plugin’s routing rules.
The plugin should:
- Examine the request
- Process it or decide to pass through
- Return an appropriate result
Possible returns:
- response: Plugin handled the request, return the response
- pass-through: Plugin chose not to handle, continue to next handler
- error: Plugin encountered an error processing the request
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.