rhai/codegen/ui_tests/return_mut_ref.rs

24 lines
354 B
Rust
Raw Normal View History

2020-08-01 18:52:26 +02:00
use rhai::export_fn;
#[derive(Clone)]
struct Clonable {
a: f32,
b: u32,
c: char,
d: bool,
}
#[export_fn]
pub fn test_fn(input: &mut Clonable) -> &mut bool {
&mut input.d
}
fn main() {
let n = Clonable { a: 0.0, b: 10, c: 'a', d: true };
if test_fn(n) {
println!("yes");
} else {
println!("no");
}
}