From b83ec3dd4dc1c25f54d50b907452fd8245bfcc5b Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Thu, 8 Dec 2022 22:25:55 +0100
Subject: [PATCH] RUST: The safe part of the rust lib should use the
 lektor_c_compat::rs_types types and not the lektor_c_compat::c_types types.

---
 .../liblektor-rs/lektor_c_compat/src/lib.rs   |  3 +++
 .../lektor_c_compat/src/rs_types.rs           | 21 +++++++++++++++++++
 src/rust/liblektor-rs/lektor_repo/src/lib.rs  |  4 ++--
 3 files changed, 26 insertions(+), 2 deletions(-)
 create mode 100644 src/rust/liblektor-rs/lektor_c_compat/src/rs_types.rs

diff --git a/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs b/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs
index f17bb99b..a946a73e 100644
--- a/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs
+++ b/src/rust/liblektor-rs/lektor_c_compat/src/lib.rs
@@ -6,6 +6,9 @@
 
 pub mod c_types;
 
+mod rs_types;
+pub use rs_types::*;
+
 pub use libc::{c_char, c_int, c_long, c_void, size_t};
 
 /// The maximal length of a tag in lektor.
diff --git a/src/rust/liblektor-rs/lektor_c_compat/src/rs_types.rs b/src/rust/liblektor-rs/lektor_c_compat/src/rs_types.rs
new file mode 100644
index 00000000..5f914a64
--- /dev/null
+++ b/src/rust/liblektor-rs/lektor_c_compat/src/rs_types.rs
@@ -0,0 +1,21 @@
+use crate::c_types::*;
+
+pub struct LktCQueue {
+    c_ptr: LktQueuePtr,
+}
+
+pub struct LktCUri {
+    c_ptr: LktUriPtr,
+}
+
+impl From<LktQueuePtr> for LktCQueue {
+    fn from(c_ptr: LktQueuePtr) -> Self {
+        Self { c_ptr }
+    }
+}
+
+impl From<LktUriPtr> for LktCUri {
+    fn from(c_ptr: LktUriPtr) -> Self {
+        Self { c_ptr }
+    }
+}
diff --git a/src/rust/liblektor-rs/lektor_repo/src/lib.rs b/src/rust/liblektor-rs/lektor_repo/src/lib.rs
index 3552656f..78bd5497 100644
--- a/src/rust/liblektor-rs/lektor_repo/src/lib.rs
+++ b/src/rust/liblektor-rs/lektor_repo/src/lib.rs
@@ -1,8 +1,8 @@
 //! The crate responsible of downloading karas from kurisu.
 
-use lektor_c_compat::c_types::*;
+use lektor_c_compat::*;
 
 /// The structure responsible to download karas from kurisu.
 pub struct LktModuleRepoRs {
-    queue: LktQueuePtr,
+    queue: LktCQueue,
 }
-- 
GitLab