Skip to main content

PreviewProvider

Trait PreviewProvider 

Source
pub trait PreviewProvider:
    Send
    + Sync
    + Debug {
    // Required methods
    fn id(&self) -> &str;
    fn handles(&self) -> Handles;
    fn preview(
        &self,
        request: &PreviewRequest,
    ) -> Result<Option<Preview>, String>;

    // Provided methods
    fn priority(&self) -> i32 { ... }
    fn accepts(&self, probe: &Probe<'_>) -> bool { ... }
}
Expand description

A provider of previews.

Required Methods§

Source

fn id(&self) -> &str

Its id, for the bridge and the messages (images, my_app.raw).

Source

fn handles(&self) -> Handles

Which files it handles (read once, when it is registered).

Source

fn preview(&self, request: &PreviewRequest) -> Result<Option<Preview>, String>

The preview (on a worker thread): Ok(None) passes to the next provider, an error is shown with its reason.

Provided Methods§

Source

fn priority(&self) -> i32

Higher first. The built-in providers are at 0 (text at -10), the system’s thumbnails at -100.

Source

fn accepts(&self, probe: &Probe<'_>) -> bool

Whether it takes a path its Handles match; all of them, by default.

Implementors§

Source§

impl PreviewProvider for Folders

Source§

impl PreviewProvider for Images

Available on crate feature image-previews only.
Source§

impl PreviewProvider for Markdown

Source§

impl PreviewProvider for Text