2020-08-03 02:27:19 +02:00
|
|
|
use rhai::plugin::*;
|
2020-08-01 18:52:26 +02:00
|
|
|
|
|
|
|
#[derive(Clone)]
|
|
|
|
struct Clonable {
|
|
|
|
a: f32,
|
|
|
|
b: u32,
|
|
|
|
c: char,
|
|
|
|
d: bool,
|
|
|
|
}
|
|
|
|
|
|
|
|
#[export_fn]
|
2020-08-02 09:39:08 +02:00
|
|
|
pub fn test_fn(input: Clonable) -> &'static str {
|
2020-08-01 18:52:26 +02:00
|
|
|
"yes"
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2020-08-02 09:39:08 +02:00
|
|
|
let n = Clonable {
|
|
|
|
a: 0.0,
|
|
|
|
b: 10,
|
|
|
|
c: 'a',
|
|
|
|
d: true,
|
|
|
|
};
|
2020-08-01 18:52:26 +02:00
|
|
|
println!("{}", test_fn(n));
|
|
|
|
}
|