reflective

Crates.ioreflective
lib.rsreflective
version0.1.0
sourcesrc
created_at2019-02-21 10:33:12.249174
updated_at2019-02-21 10:33:12.249174
descriptionHacky compile-time reflection
homepage
repository
max_upload_size
id116187
size6,529
Sam (pigeonhands)

documentation

README

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");
}
Commit count: 0

cargo fmt