aboutsummaryrefslogtreecommitdiff
path: root/core_c/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'core_c/src/lib.rs')
-rw-r--r--core_c/src/lib.rs41
1 files changed, 0 insertions, 41 deletions
diff --git a/core_c/src/lib.rs b/core_c/src/lib.rs
deleted file mode 100644
index 6efd0e9..0000000
--- a/core_c/src/lib.rs
+++ /dev/null
@@ -1,41 +0,0 @@
-use std::ffi::{c_char, CStr, CString};
-
-pub mod data_c;
-pub mod service_c;
-
-pub fn str_rs_to_c(s: String) -> (CString, *const c_char) {
- let c_string = CString::new(s).expect("");
- let ptr = c_string.as_ptr();
- (c_string, ptr)
-}
-
-pub fn str_c_to_rs(ptr: *const c_char) -> Option<String> {
- if ptr.is_null() {
- return None;
- }
- unsafe {
- CStr::from_ptr(ptr)
- .to_str()
- .ok()
- .map(|s| s.to_owned())
- }
-}
-
-#[macro_export]
-macro_rules! box_into_raw {
- ($expr:expr) => {
- $crate::box_into_raw!(@inner $expr)
- };
-
- ($expr:expr => $t:ty) => {
- $crate::box_into_raw!(@inner ($expr) as $t)
- };
-
- (@inner $expr:expr) => {
- ::std::boxed::Box::into_raw(::std::boxed::Box::new($expr))
- };
-
- (@inner ($expr:expr) as $t:ty) => {
- ::std::boxed::Box::into_raw(::std::boxed::Box::new($expr) as ::std::boxed::Box<$t>)
- };
-} \ No newline at end of file