field_ref_of

Macro field_ref_of 

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

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

§Examples

use field_ref::{FieldRef, field_ref_of};

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