Macro field_ref::field_ref_of [] [src]

macro_rules! field_ref_of {
    ($t:ty $(=> $f:tt)+) => { ... };
}

Creates a new FieldRef from basic type and fields which are (recursively) contained by that type.

Examples

#[macro_use]
extern crate field_ref;

use field_ref::FieldRef;

struct Foo(u32, u32);

// references Foo.1
let fr = field_ref_of!(Foo => 1);
let foo = Foo(10, 20);
assert_eq!(fr.get(&foo), &20);