1 macro_rules! impl_writeable {
2 ($st:ident, $len: expr, {$($field:ident),*}) => {
3 impl<W: Writer> Writeable<W> for $st {
4 fn write(&self, w: &mut W) -> Result<(), ::std::io::Error> {
6 $( self.$field.write(w)?; )*
11 impl<R: Read> Readable<R> for $st {
12 fn read(r: &mut R) -> Result<Self, DecodeError> {
14 $($field: Readable::read(r)?),*
20 macro_rules! impl_writeable_len_match {
21 ($st:ident, {$({$m: pat, $l: expr}),*}, {$($field:ident),*}) => {
22 impl<W: Writer> Writeable<W> for $st {
23 fn write(&self, w: &mut W) -> Result<(), ::std::io::Error> {
24 w.size_hint(match *self {
27 $( self.$field.write(w)?; )*
32 impl<R: Read> Readable<R> for $st {
33 fn read(r: &mut R) -> Result<Self, DecodeError> {
35 $($field: Readable::read(r)?),*