1 unstable release
0.1.0 | Feb 21, 2019 |
---|
#2351 in Procedural macros
7KB
110 lines
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");
}