[][src]Crate zathura_plugin

A Rust wrapper around Zathura's plugin API, allowing plugin development in Rust.

This library wraps the plugin interface and exposes the ZathuraPlugin trait and the plugin_entry! macro as the primary way to implement a Rust plugin for Zathura.

Examples

struct PluginType {}

impl ZathuraPlugin for PluginType {
    type DocumentData = ();
    type PageData = ();

    fn document_open(doc: DocumentRef<'_>) -> Result<DocumentInfo<Self>, PluginError> {
        unimplemented!()
    }

    fn page_init(page: PageRef<'_>, doc_data: &mut ()) -> Result<PageInfo<Self>, PluginError> {
        unimplemented!()
    }

    fn page_render(
        page: PageRef<'_>,
        doc_data: &mut Self::DocumentData,
        page_data: &mut Self::PageData,
        cairo: &mut cairo::Context,
        printing: bool,
    ) -> Result<(), PluginError> {
        unimplemented!()
    }
}

plugin_entry!("MyPlugin", PluginType, ["text/plain", "application/pdf"]);

Re-exports

pub use zathura_plugin_sys as sys;

Macros

plugin_entry

Declares this library as a Zathura plugin.

Structs

DocumentInfo

Information needed to configure a Zathura document.

DocumentRef

A mutable reference to a Zathura document.

PageInfo

Information needed to configure a document page.

PageRef

Reference to a page in a document.

Enums

PluginError

Errors understood by Zathura.

Traits

ZathuraPlugin

Trait to be implemented by Zathura plugins.