File: first_shared_ref.rs

package info (click to toggle)
rust-rhai-codegen 2.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 888 kB
  • sloc: makefile: 2
file content (28 lines) | stat: -rw-r--r-- 419 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#![allow(deprecated)]
use rhai::plugin::*;

struct NonClonable {
    a: f32,
    b: u32,
    c: char,
    d: bool,
}

#[export_fn]
pub fn test_fn(input: &NonClonable) -> bool {
    input.d
}

fn main() {
    let n = NonClonable {
        a: 0.0,
        b: 10,
        c: 'a',
        d: true,
    };
    if test_fn(n) {
        println!("yes");
    } else {
        println!("no");
    }
}