Init commit

This commit is contained in:
jimmy committed 2026-07-04 09:43:44 -04:00
commit 4f509b4ad6
7 files changed
+505

No files matched your search

+35
View File
@@ -0,0 +1,35 @@
#![allow(non_snake_case)]
#[cxx::bridge]
mod ffi {
extern "Rust" {
fn add(a: &f64, b: &f64) -> f64;
type MyStruct;
fn MyStruct_build(a: f64, b: f64) -> Box<MyStruct>;
fn sum(self: &MyStruct) -> f64;
}
}
pub struct MyStruct {
a: f64,
b: f64
}
impl MyStruct {
pub fn new(a: f64, b: f64) -> Self {
MyStruct {a: a, b: b}
}
pub fn sum(&self) -> f64 {
self.a + self.b
}
}
fn MyStruct_build(a: f64, b: f64) -> Box<MyStruct> {
Box::new(MyStruct::new(a, b))
}
pub fn add(a: &f64, b: &f64) -> f64 {
a + b
}