diff --git a/src/document.rs b/src/document.rs index 9388651..3ae7fcc 100644 --- a/src/document.rs +++ b/src/document.rs @@ -300,6 +300,12 @@ impl Drop for Document { } } +impl Clone for Document { + fn clone(&self) -> Self { + unsafe { Document::from_raw(fz_keep_document(context(), self.inner)) } + } +} + #[derive(Debug)] pub struct PageIter<'a> { index: i32, diff --git a/src/page.rs b/src/page.rs index 111c1ea..455f9f7 100644 --- a/src/page.rs +++ b/src/page.rs @@ -337,6 +337,12 @@ impl Drop for Page { } } +impl Clone for Page { + fn clone(&self) -> Self { + unsafe { Page::from_raw(fz_keep_page(context(), self.inner)) } + } +} + #[derive(Debug)] pub struct LinkIter { next: *mut fz_link,