Crates.io | reflective |
lib.rs | reflective |
version | 0.1.0 |
source | src |
created_at | 2019-02-21 10:33:12.249174 |
updated_at | 2019-02-21 10:33:12.249174 |
description | Hacky compile-time reflection |
homepage | |
repository | |
max_upload_size | |
id | 116187 |
size | 6,529 |
use reflective::{reflective};
#[reflective]
pub struct TestStruct{
name: &'static str,
}
#[test]
fn reflection(){
let s = &mut TestStruct{
name: "sam",
};
let mut res : &str = TestStruct::get_field(s, "name");
assert_eq!(res, "sam");
TestStruct::set_field(s, "name", "mas");
assert_eq!(s.name, "mas");
}