6 releases (3 breaking)
0.4.0 | May 3, 2019 |
---|---|
0.3.1 | May 3, 2019 |
0.2.1 | May 2, 2019 |
0.1.0 | May 1, 2019 |
#75 in #plugin-api
31 downloads per month
54KB
495 lines
A Zathura Plugin API wrapper for Rust
This crate wraps Zathura's Plugin API in a memory- and typesafe Rust interface, and allows writing Zathura plugins in Rust.
Please refer to the changelog to see what changed in the last releases.
Usage
Add an entry to your Cargo.toml
:
[dependencies]
zathura-plugin = "0.4.0"
Check the API Documentation for how to use the crate's functionality.
lib.rs
:
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"]);
Dependencies
~0.5–3.5MB
~63K SLoC