pub trait SlideFfi: Send + Sync {
// Required methods
fn info(&self) -> FfiResult<RString>;
fn read_region(
&self,
region: SlideRegion,
out: RSliceMut<'_, u8>,
) -> FfiResult<()>;
fn read_associated_image(&self, name: RStr<'_>) -> FfiResult<Pixels>;
fn call(&self, method: RStr<'_>, args_json: RStr<'_>) -> FfiResult<RString>;
}Expand description
One open slide.
Send + Sync: render workers read regions concurrently, from several
threads at once on the same handle, with none of the host’s locks held.
The host drops the handle (from any thread, possibly after the plugin’s
shutdown) when the slide is closed everywhere.
Required Methods§
Sourcefn info(&self) -> FfiResult<RString>
fn info(&self) -> FfiResult<RString>
The slide’s metadata as a JSON crate::protocol::SlideInfo.
Called once, right after opening; the host validates it.
Sourcefn read_region(
&self,
region: SlideRegion,
out: RSliceMut<'_, u8>,
) -> FfiResult<()>
fn read_region( &self, region: SlideRegion, out: RSliceMut<'_, u8>, ) -> FfiResult<()>
Writes region into out: region.width·region.height·4 bytes of
RGBA with straight alpha, rows top to bottom, no padding. out
arrives zeroed, i.e. transparent: pixels without image data may be
left alone (the host shows them as the slide’s background).
Sourcefn read_associated_image(&self, name: RStr<'_>) -> FfiResult<Pixels>
fn read_associated_image(&self, name: RStr<'_>) -> FfiResult<Pixels>
Decodes the associated image name (one listed in
crate::protocol::SlideInfo::associated_images, at the size listed
there) as RGBA with straight alpha.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".