From: Ramakrishnan Muthukrishnan <ram@leastauthority.com>
Date: Fri, 17 Feb 2023 09:41:11 +0000 (+0530)
Subject: initial test rust code
X-Git-Url: https://git.rkrishnan.org/pf/vdrive/simplejson//%22file:/%22?a=commitdiff_plain;h=refs%2Fheads%2Ft1;p=pihpsdr.git

initial test rust code
---

diff --git a/rust/Cargo.toml b/rust/Cargo.toml
new file mode 100644
index 0000000..48363f2
--- /dev/null
+++ b/rust/Cargo.toml
@@ -0,0 +1,12 @@
+[package]
+name = "hpsdr"
+version = "0.1.0"
+edition = "2021"
+authors = ["Ramakrishnan Muthukrishnan <ram@rkrishnan.org>"]
+
+[dependencies]
+libc = "0.2"
+
+[lib]
+name = "hpsdr"
+crate-type = ["staticlib"]
diff --git a/rust/src/lib.rs b/rust/src/lib.rs
new file mode 100644
index 0000000..5d7f64a
--- /dev/null
+++ b/rust/src/lib.rs
@@ -0,0 +1,17 @@
+use libc::{size_t};
+
+#[no_mangle]
+pub extern fn add(left: size_t, right: size_t) -> size_t {
+    left + right
+}
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn it_works() {
+        let result = add(2, 2);
+        assert_eq!(result, 4);
+    }
+}