#![allow(warnings)] pub use cairo::ffi::*; use typst::layout::{Abs, Point, Rect}; include!(concat!(env!("OUT_DIR"), "/bindings.rs")); unsafe impl Sync for zathura_plugin_definition_s {} pub type zathura_plugin_error_e = ZathuraResult; #[repr(u32)] pub enum ZathuraResult { /// No error occurred OK = 0, /// An unknown error occurred Unknown = 1, /// Out of memory OutOfMemory = 2, /// The called function has not been implemented NotImplemented = 3, /// Invalid arguments have been passed InvalidArguments = 4, /// The provided password is invalid InvalidPassword = 5, } impl From for Rect { fn from(rect: zathura_rectangle_s) -> Self { fn min(a: f64, b: f64) -> f64 { if a < b { a } else { b } } fn max(a: f64, b: f64) -> f64 { if a > b { a } else { b } } Rect::new( Point::new( Abs::pt(min(rect.x1, rect.x2)), Abs::pt(min(rect.y1, rect.y2)), ), Point::new( Abs::pt(max(rect.x1, rect.x2)), Abs::pt(max(rect.y1, rect.y2)), ), ) } }