[][src]Macro rcodec::record_struct

macro_rules! record_struct {
    { $stype:ident, $($fieldname:ident: $fieldtype:ty),+ } => { ... };
}

Defines a struct that has derived impls for some common traits along with implementations of the FromHList and ToHList traits, taking all fields into account.

Examples

use pl_hlist::*;
use rcodec::*;

record_struct!(
    TestStruct,
    foo: u8,
    bar: u32
);

let hlist = hlist!(7u8, 666u32);
let s = TestStruct::from_hlist(hlist);
assert_eq!(s, TestStruct { foo: 7, bar: 666 });