Crates.io | cxc_derive |
lib.rs | cxc_derive |
version | 0.2.0 |
source | src |
created_at | 2023-06-24 23:32:13.518754 |
updated_at | 2023-09-24 02:38:27.207883 |
description | Derive crate for cxc |
homepage | http://amjoshuamichael.com/cxc/ |
repository | https://github.com/amjoshuamichael/cxc_derive/ |
max_upload_size | |
id | 899194 |
size | 25,505 |
use cxc::Unit;
use cxc::XcReflect;
#[derive(Default, Clone, Copy, Debug, XcReflect, PartialEq, Eq)]
pub struct Numbers5 {
pub a: i32,
pub b: i32,
pub c: i32,
pub d: i32,
pub e: i32,
}
#[test]
fn numbers_5() {
let mut unit = Unit::new();
unit.add_reflect_type::<Numbers5>();
unit.add_external_default::<Numbers5>();
unit.push_script(
"
some_numbers(); Numbers5 {
; Numbers5 { a = 4, b = 9, c = 39, ++ }
}
"
).unwrap();
let some_numbers = unit.get_fn("some_numbers").unwrap().downcast::<(), Numbers5>();
let numbers5 = some_numbers();
assert_eq!(numbers5, Numbers5 { a: 4, b: 9, c: 39, ..Default::default() });
}
Supports regular struct types, enums, tuples, function types, references, raw pointers, etc. AFAIK, the only thing it doesn't support it Unions, because those aren't in cxc. If there's anything that it doesn't support that you think it should, then please submit an issue