Skip to main content

FrameLoader

Trait FrameLoader 

Source
pub trait FrameLoader: Send + Sync {
    // Required method
    fn load(&self, source: &str) -> Option<Frame>;
}
Expand description

Loads a Frame for a source string on demand, off the UI thread.

This is the pluggable seam silx exposes through ImageStack.setUrlLoaderClass (ImageStack.py :207-223): the stack does not know how to turn a DataUrl into pixels — it delegates to a loader. ImageStack::set_sources hands the loader one opaque source string (an HDF5/image URL, a file path — whatever the concrete loader understands) per slot; load is then called on a background thread when that slot is browsed to or prefetched.

Implementors MUST be Send + Sync (the load runs on a spawned thread) and SHOULD return None rather than panicking when a source cannot be read, mirroring silx UrlLoader.run returning None on OSError (ImageStack.py :141-145). A None result marks the slot failed and is not retried.

Required Methods§

Source

fn load(&self, source: &str) -> Option<Frame>

Load the frame for source, or None if it cannot be read. Runs on a background thread; keep it self-contained (no shared mutable UI state).

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§