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§
Sourcefn call(&self, method: RStr<'_>, args_json: RStr<'_>) -> FfiResult<RString>
fn call(&self, method: RStr<'_>, args_json: RStr<'_>) -> FfiResult<RString>
Invokes the JSON method method (see crate::protocol::methods).
Sourcefn read_region(&self, request: RegionRequest) -> FfiResult<Pixels>
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.
Sourcefn read_associated_image(
&self,
file_id: i64,
name: RStr<'_>,
) -> FfiResult<Pixels>
fn read_associated_image( &self, file_id: i64, name: RStr<'_>, ) -> FfiResult<Pixels>
Reads an associated image ("label", "macro", "thumbnail", …).
Sourcefn put_raster(&self, raster: RasterUpload) -> FfiResult<()>
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".