Skip to main content

PluginInstance

Trait PluginInstance 

Source
pub trait PluginInstance:
    Send
    + Sync
    + 'static {
    // Required methods
    fn adapter(&self) -> PluginAdapter;
    fn call(&self, operation: &str, input: &[u8]) -> Result<Vec<u8>, HostError>;

    // Provided method
    fn health_check(&self) -> Result<(), HostError> { ... }
}
Expand description

One callable plugin implementation. 一个可调用的插件实现。

Required Methods§

Source

fn adapter(&self) -> PluginAdapter

The execution adapter that backs this instance. 该实例所依托的执行适配器。

Source

fn call(&self, operation: &str, input: &[u8]) -> Result<Vec<u8>, HostError>

Run one operation against the plugin and return its raw response bytes. The adapter enforces its own limits and reports every failure as HostError. 对插件执行一次操作并返回原始响应字节;适配器自行实施限制,并把所有失败报告为 HostError。

Provided Methods§

Source

fn health_check(&self) -> Result<(), HostError>

Confirm the instance answers a health call with exactly ok. 确认实例对 health 调用给出的回答正好是 ok。

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§