1 macro_rules! impl_writeable {
2 ($st:ident, $len: expr, {$($field:ident),*}) => {
3 impl ::util::ser::Writeable for $st {
4 fn write<W: ::util::ser::Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
8 $( self.$field.write(w)?; )*
13 impl<R: ::std::io::Read> ::util::ser::Readable<R> for $st {
14 fn read(r: &mut R) -> Result<Self, ::ln::msgs::DecodeError> {
16 $($field: ::util::ser::Readable::read(r)?),*
22 macro_rules! impl_writeable_len_match {
23 ($st:ident, {$({$m: pat, $l: expr}),*}, {$($field:ident),*}) => {
24 impl Writeable for $st {
25 fn write<W: Writer>(&self, w: &mut W) -> Result<(), ::std::io::Error> {
26 w.size_hint(match *self {
29 $( self.$field.write(w)?; )*
34 impl<R: ::std::io::Read> Readable<R> for $st {
35 fn read(r: &mut R) -> Result<Self, DecodeError> {
37 $($field: Readable::read(r)?),*