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"); }