Skip to main content

HostFfi

Trait HostFfi 

Source
pub trait HostFfi: Send + Sync {
    // Required methods
    fn call(&self, method: RStr<'_>, args_json: RStr<'_>) -> FfiResult<RString>;
    fn read_region(&self, request: RegionRequest) -> FfiResult<Pixels>;
    fn read_associated_image(
        &self,
        file_id: i64,
        name: RStr<'_>,
    ) -> FfiResult<Pixels>;
    fn put_raster(&self, raster: RasterUpload) -> FfiResult<()>;
}
Expand description

The host services available to one plugin.

Every method may be called from any thread. None of them blocks on the host’s UI thread: queries are answered from published state and UI mutations are queued and applied in call order.

Required Methods§

Source

fn call(&self, method: RStr<'_>, args_json: RStr<'_>) -> FfiResult<RString>

Invokes the JSON method method (see crate::protocol::methods).

Source

fn read_region(&self, request: RegionRequest) -> FfiResult<Pixels>

Reads slide pixels on the calling thread through a plugin-private slide handle. Never holds host state locks while decoding.

Source

fn read_associated_image( &self, file_id: i64, name: RStr<'_>, ) -> FfiResult<Pixels>

Reads an associated image ("label", "macro", "thumbnail", …).

Source

fn put_raster(&self, raster: RasterUpload) -> FfiResult<()>

Adds or replaces a raster overlay object.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl HostFfi for MockHost

Source§

impl<'lt, _ErasedPtr> HostFfi for HostFfi_TO<'lt, _ErasedPtr>
where Self: Send + Sync, _ErasedPtr: AsPtr<PtrTarget = ()>,