Skip to main content

HostServices

Trait HostServices 

Source
pub trait HostServices: Send + Sync {
    // Required methods
    fn call(&self, service: &str, request: &[u8]) -> Result<Vec<u8>, String>;
    fn notify(&self, service: &str, payload: &[u8]);
}
Expand description

Services a host exposes to the components it loads.

The host owns the meaning of service names and payload bytes; the ABI only moves bytes. Components may call from any thread, so implementations must be thread-safe. A panic in an implementation is caught at the FFI boundary and reported to the component as an error status, never unwound across it.

Required Methods§

Source

fn call(&self, service: &str, request: &[u8]) -> Result<Vec<u8>, String>

Handle a request/response call. An Err message is delivered to the component with an INTERNAL_ERROR status.

Source

fn notify(&self, service: &str, payload: &[u8])

Handle a one-way notification (progress, streaming chunks).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§