From 387b002dfa664df4ad69516dbe260242ae8e256f Mon Sep 17 00:00:00 2001 From: monoamine11231 Date: Thu, 16 May 2024 16:55:09 +0200 Subject: [PATCH 1/2] fix(Page): Clone trait implemented for Page struct using fz_keep_page --- src/page.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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, From b97aef5f70ea10a6bc31220529b3f58f72ba6dfe Mon Sep 17 00:00:00 2001 From: monoamine11231 Date: Thu, 16 May 2024 19:50:53 +0200 Subject: [PATCH 2/2] fix(document): Implemented Clone Trait --- src/document.rs | 6 ++++++ 1 file changed, 6 insertions(+) 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,